Forum Discussion

Fali324's avatar
Fali324
Icon for Helper II rankHelper II
3 years ago
Solved

Creating a measure to count based on another measure

Hi,

 

I have a measure where the output is a percentage:

DIVIDE([Area nstalled], [Total (ft2)].
 
I want to create another measure which counts how many are at 100%.
 
All help is much appricated.
 
Thank you
  • Hi,

    Try using COUNTROWS. Here is an example:

    Data:

    Dax:

    How many at 100% = var _vtable =  
    ADDCOLUMNS(ALL('Table (34)'),"%",CALCULATE(DIVIDE(MAX('Table (34)'[Column1]),MAX('Table (34)'[Column2])))) return
    COUNTROWS(FILTER(_vtable,[%] = 1 ))


    Replace the bolded part with your measure and 'table (34)' with your table and you should be good. The logic is that we are adding a calculated column to a fact table and filtering the rows which have value of 100% then we count the rows resulting in the end result.

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

1 Reply

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

    Hi,

    Try using COUNTROWS. Here is an example:

    Data:

    Dax:

    How many at 100% = var _vtable =  
    ADDCOLUMNS(ALL('Table (34)'),"%",CALCULATE(DIVIDE(MAX('Table (34)'[Column1]),MAX('Table (34)'[Column2])))) return
    COUNTROWS(FILTER(_vtable,[%] = 1 ))


    Replace the bolded part with your measure and 'table (34)' with your table and you should be good. The logic is that we are adding a calculated column to a fact table and filtering the rows which have value of 100% then we count the rows resulting in the end result.

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/