Forum Discussion

Jebilaya's avatar
Jebilaya
Icon for Helper III rankHelper III
4 years ago
Solved

Count DAX to avoid % Grand Total

I want to create a measure so that I don't have to use the % Grand Total so I can format the % decimal places.

The Dax for postcode participation measure is currently 

PostcodeParticipation = counta('Microlise Files'[Customer Name])
but I need it to be as a % of the total.  So UB would be 10 / 1362.  I cannot get the divide part of the equation in DAX correct.  Please help!

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Jebilaya ,

     

    Please try this measure.

     

    %GT Count of Customer Name =
    SUMX (
        SUMMARIZE (
            'Microlise Files',
            'Microlise Files'[Postcode],
            "%GT",
                DIVIDE (
                    [PostcodeParticipation],
                    CALCULATE (
                        COUNTA ( 'Microlise Files'[Customer Name] ),
                        ALL ( 'Microlise Files' )
                    )
                )
        ),
        [%GT]
    )

     

    Attached PBIX file for reference.

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

3 Replies

  • Jebilaya , You can create a new column and mark that % column and choose decimal place

     

    divide([PostcodeParticipation], calculate([PostcodeParticipation], allselected())

     

    or

     

    divide([PostcodeParticipation], calculate([PostcodeParticipation], all())

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Jebilaya ,

     

    Please try this measure.

     

    %GT Count of Customer Name =
    SUMX (
        SUMMARIZE (
            'Microlise Files',
            'Microlise Files'[Postcode],
            "%GT",
                DIVIDE (
                    [PostcodeParticipation],
                    CALCULATE (
                        COUNTA ( 'Microlise Files'[Customer Name] ),
                        ALL ( 'Microlise Files' )
                    )
                )
        ),
        [%GT]
    )

     

    Attached PBIX file for reference.

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data