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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sander76
Regular Visitor

Calculation on lowest level of the hierarchies and summing the results on aggregated levels

Dear All, I have an issue with getting the correct result on aggregated levels. I have a model with three  factables  (all related to the same dim tables and also good to now it is in direct query mode);

Cost Per unit:

ScreenHunter 697.png

 Bill of Materials

ScreenHunter 696.png

 

 And a third one where I create the result, in the model this table is actualy empty and filled with a measure;

ScreenHunter 698.png

Where MeasureCost is the following

MeasureCost = SUMX('OLAP CUBE_Cost per Unit_WB','OLAP CUBE_Cost per Unit_WB'[Amount])*SUMX('OLAP CUBE_BOM_WB','OLAP CUBE_BOM_WB'[Amount])
 
If I do this I get the following result, which is correct on lowest level, but not on agggregations;
ScreenHunter 699.png
On aggregation actualy the calculation is performed instead of summing up the result .
 
Normally I would solve this with calculated columns but in this case this isn't possible becasue it is in direct query mode and I cannot use the aggregation function becasue they are not supported in direc query mode.
 
Direct query mode is mandatory in this case.
 
Can anyone help me out here?
 
KR, Sander
1 ACCEPTED SOLUTION
Sander76
Regular Visitor

I found the solution. First calculated the measure, and then used another measure with sumx to also get it OK on aggregated level;

Sander76_0-1615536160868.png

Amount1 = CALCULATE(SUM(Sheet1[ Price])*SUM(Sheet1[Quantity]))
Amount2 = SUMX(Sheet1,[Amount1])

View solution in original post

5 REPLIES 5
Sander76
Regular Visitor

I found the solution. First calculated the measure, and then used another measure with sumx to also get it OK on aggregated level;

Sander76_0-1615536160868.png

Amount1 = CALCULATE(SUM(Sheet1[ Price])*SUM(Sheet1[Quantity]))
Amount2 = SUMX(Sheet1,[Amount1])
Sander76
Regular Visitor

Found the solution, will post the pbix also

Sander76
Regular Visitor

Will also post a simplified model

Sander76
Regular Visitor

I think I'm almost there, formala need to besomething like

 

MeasureCost = if(HASONEVALUE('OLAP Cost Type'[ID]),SUMX('OLAP CUBE_Cost per Unit_WB','OLAP CUBE_Cost per Unit_WB'[Amount])*SUMX('OLAP CUBE_BOM_WB','OLAP CUBE_BOM_WB'[Amount]),[Some Formula that aggregates the lower levels instead of performing the calc])
v-easonf-msft
Community Support
Community Support

Hi, @Sander76 

Can you decompressed your real-life problem into a simple case?

If you can  provide a sample pbix for testing,it will helop us understand and deal with this problem.

 

Best Regards,
Community Support Team _ Eason

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.