Forum Discussion

Lidou_Cand's avatar
Lidou_Cand
Helper III
5 years ago
Solved

Calculate Ratio Issue

Hello, I'm newbie in dax. I need your help to calculate a ratio. I have a matrix like this:  I need to calculate a ratio like this: Sales Customer / Sales Category Can you help me ? Is ther...
  • v-alq-msft's avatar
    5 years ago

    Hi, Lidou_Cand 

     

    You may try the following measure to see if it helps. The pbix file is attached in the end.

    Result = 
    IF(
        NOT(ISBLANK([Sales Amount])),
        DIVIDE(
            [Sales Amount],
            CALCULATE(
                [Sales Amount],
                FILTER(
                    ALL(Sales),
                    RELATED('Product'[Category])=SELECTEDVALUE('Product'[Category])&&
                    RELATED('Date'[Year]) in DISTINCT('Date'[Year])
                )
            )
        )
    )

     

    Result:

     

    Best Regards

    Allan

     

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