Forum Discussion

Roskalnikov's avatar
Roskalnikov
Frequent Visitor
3 years ago
Solved

Writing Dax for Percentages based on Conditions

Hi everyone,

 

I'm having trouble figuring out the apporpirate formula to calculate the below:

(Sum of number of practitioners for year ranges < 1 year and 1-5 years)/(Sum of number of practitioners for year ranges 6-10, 11-20 and 21+ years) * 100

 

An example of my table is below. Any help is much appreciated. 

 

Kind regards,

Roskalnikov

 

 

  • Hi Roskalnikov,

     

    You could use SUMX and DIVIDE. Create a new measure as follows.

     

    Measure =

    VAR _Group1 = SUMX( FILTER(Table, Table[Years Intended to Work] <= 5), Table[Number of Practitioners])
    VAR _Group2 = SUMX( FILTER(Table, Table[Years Intended to Work] > 5 ), Table[Number of Practitioners])
    VAR _Division = DIVIDE( _Group1, _Group2)
    RETURN
    _Division * 100


    Hope this helps!

2 Replies

  • ovde's avatar
    ovde
    Icon for Resolver II rankResolver II

    Hi Roskalnikov,

     

    You could use SUMX and DIVIDE. Create a new measure as follows.

     

    Measure =

    VAR _Group1 = SUMX( FILTER(Table, Table[Years Intended to Work] <= 5), Table[Number of Practitioners])
    VAR _Group2 = SUMX( FILTER(Table, Table[Years Intended to Work] > 5 ), Table[Number of Practitioners])
    VAR _Division = DIVIDE( _Group1, _Group2)
    RETURN
    _Division * 100


    Hope this helps!