Forum Discussion

7 Replies

    • fahadqadir's avatar
      fahadqadir
      Helper I

      Yes, I use this approach but I don't know how I add my Percentage churn measure to the calculation to find % churn by dynamic bin size.

      • Migasuke's avatar
        Migasuke
        Memorable Member

        Hi,
        I really like solution which indkitty posted. It basically avoid the problem with dynamic columns in a table.
        This solution seems to be better than the M parameter. In case you need % distribution I edited measure Radacad has.

         

        Count of Customers in each Band = 
        var _minAge=[Min Age]
        var _maxAge=[Max Age]
        var _bandSize=[Band Size Value]
        var _AgeBandTable=GENERATESERIES(_minAge,_maxAge,_bandSize)
        var _currAge=SELECTEDVALUE('Age Band'[Age])
        var _bandHead=MAXX(
            FILTER(
            _AgeBandTable,
            [Value]<=_currAge),[Value])
        var _bandTail=_bandHead+_bandSize
        var _allNumber = CALCULATE(COUNTROWS(DimCustomer),ALL(DimCustomer))
        var _numberCount = if(_currAge=_bandHead,
        CALCULATE(
            COUNTROWS(DimCustomer),
        'Age Band'[Age]>=_bandHead && 'Age Band'[Age]<_bandTail
        ))
        
        return
        DIVIDE(_numberCount,_allNumber)

         

        Basically I created a variable, where I calculate ALL people and in return statement I divide it (to get %).

        Result looks like this:

         

  • Migasuke's avatar
    Migasuke
    Memorable Member

    Hi fahadqadir ,

    depends which parameter you want to use.

    DAX doesn't support dynamic calculate columns. Theoreticaly you could open your model in Tabular editor and find your group. Since calculated group is just a DAX code, you might find something which looks like this (my Groups for Age):

    I can set up, that the values 5 (which determines size of my group) is taken from a measure / slicer, but then the group (calculated column) stops working.

    Instead you can use M query parameter. This solution is not that user friendly, but you can create calculated column in Power Query. Disadvantage is, that your table needs to be reloaded every single time you change the parameter. So in case you deal with milions of rows, its not really convenient.

    In case you would like to try the Power Query approach, let me know.

     

    • Migasuke's avatar
      Migasuke
      Memorable Member

      Actually there might be one more option and that would be having hierarchy in your data.

      For example, you predefine groups with size 1-5-10 and then you can drill down/drill up in your visuals from 1 up to 10. But again there is some downsize that in case you want to have custom size like 20, it wont be available in your drill down/up option.

    • fahadqadir's avatar
      fahadqadir
      Helper I

      I try Power Query approach by creating 2 new tables, one by parameter and other for calculations and relate to the data. but Calculations not working as expected.

       

    • fahadqadir's avatar
      fahadqadir
      Helper I

      Can you please share the best way to find the percentage churn by dynamic bins (As I select the bin size through parameter, like bin size 2, 3, 5 or 10....