Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Need help in adding a measure

Hi

I have a matrix visual included in my dashboard like shown below in the table. It basically tells for each TLs, the teams Met the target or Not. The fact table contains employee level data and the measure i have added to get the below table is =If([EmployeeCount]=0,"",if([TargetMetCount]/[EmployeeCount]>10%,"Met","Not Met")). Now i need the count of teams (sales) for each TLs who are "Met" - like show below in the Desired Outcome table.

 

TLSales 1Sales 2Sales 3Sales 4Sales 5Sales 6Sales 7
Bharath MetNot MetNot MetMet  
NikhilNot MetMetMetMet   
Abhishek MetMetMetNot MetNot Met 
Ashok    MetMetNot Met
Girish Not MetMet    
RajivNot Met  MetMetMetNot Met
Aamir  MetNot Met   
SushmaNot Met Met    
Rupika Not MetMet    
Madhu Met  Not Met  
SreejaNot Met Met    
TLDesired Outcome
Bharath2
Nikhil3
Abhishek3
Ashok2
Girish1
Rajiv3
Aamir1
Sushma1
Rupika1
Madhu1
Sreeja1
  • Anonymous's avatar
    Anonymous
    6 years ago

    Anonymous 

    You should unpivot the table to make the dax calculations easy. 

     

    1. Go to query editor, hold on Ctrl, select Sale1-7 columns, and unpivot.

    2. Close and apply, create the following count measure. 

     

    Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table',[Value]="Met"),ALLEXCEPT('Table','Table'[TL]))

     

     

    Paul Zheng _ Community Support Team
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    try this

    Measure = 
    CALCULATE(SUMX(Table, IF([TL Sales Measure] = "Met", 1, 0)), ALLEXCEPT(Table, Table[TL]) )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi

       

      Thanks, but this is giving me the total number of employees. but i need the number of teams for each TL who have achieved the target.

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        Anonymous , something like this

        if(calculate([EmployeeCount], allexcept(Table, Table[TL])) =0,"",calculate(divide([TargetMetCount],[EmployeeCount]), allexcept(Table, Table[TL]))>10%,"Met","Not Met")

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous 

    You should unpivot the table to make the dax calculations easy. 

     

    1. Go to query editor, hold on Ctrl, select Sale1-7 columns, and unpivot.

    2. Close and apply, create the following count measure. 

     

    Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table',[Value]="Met"),ALLEXCEPT('Table','Table'[TL]))

     

     

    Paul Zheng _ Community Support Team
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.