Forum Discussion

MarcinSz's avatar
MarcinSz
Frequent Visitor
3 years ago

Calculation groups - gap calculation

Hi all,

 

I have an issue with calculation groups. I've created calculation groups for P&L lines and put them to Matrix. Please have look at the snapshoot.

My problem is that when I am calculating a gap between forecast and previous forecast every data looks ok, except %Gross profit.

I would like to see here is -63,6 instead 90,9%. It's looks like calculation are based on ( Gross profit(FCT-PFCT) / Revenue[FCT-PFCT] ) instead of ( %Gross profit[FCT] - %Gross profit[PFCT] ).

Does anyone able do help?

 

 

I attached also pbix file. https://www.dropbox.com/s/5fy1u1vvpt0yie6/Calculation%20Groups%20Sample.pbix?dl=0

 

BR, 

Marcin

1 Reply

  • Hi MarcinSz ,

     

    You can try with below Dax expression which converts the percentage values (text to divisible number) into numbers, so that Power BI Dax can perform the Calculations.

     

    Difference_Text =

    VAR fctValue = IF([Name] = "%GROSS PROFIT", VALUE(SUBSTITUTE([FCT], "%", "")) / 100, [FCT])

    VAR pfctValue = IF([Name] = "%GROSS PROFIT", VALUE(SUBSTITUTE([PFCT], "%", "")) / 100, [PFCT])

    VAR differenceValue = fctValue - pfctValue

    RETURN

        IF([Name] = "%GROSS PROFIT",

           FORMAT(differenceValue, "0.0%"),

           FORMAT(differenceValue, "General Number")

        )

     

    Please refer to the screenshot given below,


    Thanks!