Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Total percentage value with a specific formula-Matrix visual

Hi All,

I have a client requirement to display the total percentage value with a specific formula, I am not sure if we can display the total of a matrix with a measure.

In the below screenshot Percentage (B/A) = 0.80% is the output by dividing column B with A i.e 2,933/368,294

But my requirement is to add Column B (859+489+50) for all non-zero values of Column A  i.e.

1,398/368,294=0.38%

 

so my client requirement is to display the 0.38% instead of 0.80%.

Please find the sample data for reference.

 

 

 

 

Please share the steps to achieve this in Power BI desktop

4 Replies

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

    Hi Anonymous 

    you can do it like this:

     

     

    Percentage = 
    VAR _SumB_OnlyByNonA_Blank = 
        CALCULATE(
            SUM('Table'[B_]),
            FILTER(
                'Table',
                'Table'[A] <> BLANK()
            )
        )
    RETURN
        DIVIDE(_SumB_OnlyByNonA_Blank,[A])

    With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi FrankAT ,

       

      Column A and Column B are measures.

       

      Could you share a tip to handle this requirement if we have measures?

  • Hi,

    The solution will depend upon whether A and B are measures or not.  Share the link from where i can download your PBI file.