Forum Discussion

pbi-bene's avatar
pbi-bene
New Member
2 years ago
Solved

Count per category

Hi, 

 

I want to show the number of accounts that use our different applications: 

 

This is how our data model is set up: 

 

Which measure should I use to have the number of these accounts and not the sum of volumes in the facttable?

 

thanks for your help! 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi pbi-bene ,

    Please try the following methods and check if they can solve your problem:

    1.Create the simple table.

    2.Create the new measure to sum Volumes.

     

    Measure = SUM('FactTable'[Volumes])

     

     

    3.Create the new measure to count account per application.

     

    count account per application = 
    if(
        ISINSCOPE('FactTable'[Account]),
        SUM('FactTable'[Volumes]), 
        CALCULATE(
            DISTINCTCOUNT(FactTable[Account]),
            filter(ALLSELECTED('FactTable'),'FactTable'[Application] = SELECTEDVALUE('FactTable'[Application]) && [Measure] > 0)
        )
    )

     

    4.Drag the count account measure into the matrix visual Values. Edit the Row subtotals.

    5.The result is shown below.

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

2 Replies

  • Hi pbi-bene 

     

    Can you share sample data for both the table reason being how the data structure in place is important?

     

    Regards

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi pbi-bene ,

    Please try the following methods and check if they can solve your problem:

    1.Create the simple table.

    2.Create the new measure to sum Volumes.

     

    Measure = SUM('FactTable'[Volumes])

     

     

    3.Create the new measure to count account per application.

     

    count account per application = 
    if(
        ISINSCOPE('FactTable'[Account]),
        SUM('FactTable'[Volumes]), 
        CALCULATE(
            DISTINCTCOUNT(FactTable[Account]),
            filter(ALLSELECTED('FactTable'),'FactTable'[Application] = SELECTEDVALUE('FactTable'[Application]) && [Measure] > 0)
        )
    )

     

    4.Drag the count account measure into the matrix visual Values. Edit the Row subtotals.

    5.The result is shown below.

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.