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
Anonymous
Not applicable

DAX Function for Consolidated Calculation

Hello everyone,

 

I need to create a measure to calculate the following operation:
Imagine a product and we have linked two more products, being: Cod. 656 - Cod. 657 - Cod. 658. I need to consolidate (sum consumption) into a single code (may be the first code 656 - reference).

 

I have two tables where the data is arranged as follows:


Table 1
Cod | Consumption | Group
656 | 10                    | A
657 | 15                    | B
658 | 05                    | C

 

Table 2
Cod 1 | Cod 2 | Cod 3 | Total consumption
656     | 657    | 658     | 30 <==== the dax function should calculate here

 

When generating a visualization or a panel, I will filter by “Group A” but the total consumption value should be displayed from all “Groups A / B / C”.


Is there any DAX function or other way to do it?

 

Gabriel

2 REPLIES 2
Anonymous
Not applicable

Thank you. I will do it this way.

Anonymous
Not applicable

First, in Power Query you have to transform your table into this form

 

Table 1
Cod | Consumption | Group|LinkId
656 | 10                    | A       |656
657 | 15                    | B       |656
658 | 05                    | C       |656

 

LinkId should be a hidden field. Second, you can create a measure 

 

[Total Consumption] =
	calculate(
		sum ( 'Table 1'[Consumption] ),
		all ( 'Table 1' ),
		values ( 'Table 1'[LinkId] )
	)

Best

D.

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.

Top Solution Authors