Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
GoBil
Regular Visitor

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.

 

GoBil_1-1661501479250.png

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 4
GoBil
Regular Visitor

Yes, I got it that you need sample data. 

I don't have the capacity currently to make it. I hope to find some time soon. 

Normally with the detailed descriptions I gave, you should already be able to understand the data I'm dealing with.

 

If someone else has any ideas how I could make this work, always welcome.

 

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Datamodel: 

GoBil_0-1661770621991.png

Data to understand: 

PNL lines: string, eg "Total Sales"

Actual TY :  Measure (sum of Actuals),  correspond with the correct PNL line. Several accounts go into one PNL line.

Actuals: numbers in Account Data Table per Account.

Dimensions:

Units: string, code representing a department

Time: Month

 

Result should be a visaul table with:

row: pnl lines

columns: actual ty, MEASURE X

filters: units, time

 

MEASURE X = 

Actuals TY/ Actuals TY 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 TY/ Actuals TY of "Total Gross profit" Line.

Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors