Forum Discussion

GoBil's avatar
GoBil
Regular Visitor
4 years ago

Measure with conditional calculation not working

Hi Community!

 

I'm stuck with a calculation I would like to do in DAX and was hoping to get your help.

I'm creating a financial report, showing already actuals, last year actuals, forecast and goals.

Now I need to add a column (Index %) to the overview that is showing per row the Actuals/ Actuals of "Total Sales" Line.

Except for the "Lines Sales of Goods" and "Sales of Product Related Services" I should have the value of the Actuals / Actuals of "Total Gross profit" Line.

 

I already tried several calculations in DAX, working with Calculated, SUM, Filter etc. 

I have created the following measure already:

Actuals TY = Calculate(SUM('Account Data'[Actuals]))
 
Total Sales = CALCULATE(SUM('Account Data'[Actuals]), FILTER('Account Data','Account Data'[Official Lines]= "Total Sales"), 'Account Data'[Unit], Units[Unit], 'Account Data'[Business Group], 'Business Group'[Business Group], 'Account Data'[Period], 'Calendar'[Period])
-> is not properly working. If I add it as a column, just to test the values, I only get a vaule for Total Sales Line, while I should get the value of Total Sales in all the Lines.
 
Sales Index = Iferror([Actuals TY]/[Total Sales], "")

-> Here I should have a IF function I suppose, where I take Total Gross Profit in case the pnl line is Sales of Goods Or Sales of PRS.

 

FYI, maybe also need to know that I'm working with a two facts data model, the Row "Official PnL lines" are coming from dimension table (many-1 rel.)

 

Not even sure it is possible or easy to implement, but any tips are welcome!

Thanks in advance!

4 Replies