Forum Discussion
Anonymous
3 years agoNot applicable
Sum elements in a table discriminating one dimension
Hello, I am looking for a way to sum elements in a table discriminating one dimension while including another dimension. Here in this example, I want the sum of errors for the "Jean" and "Shirt"...
- 3 years ago
Hi,
Please check the below picture and the attached pbix file.
Ventes measure: = CALCULATE( SUM(Data[Value]), Data[Attribute] = "Ventes")Forecast measure: = CALCULATE( SUM(Data[Value]), Data[Attribute] = "Forecast")Error measure: = IF ( ISINSCOPE ( 'Month'[Month] ), ABS ( [Ventes measure:] - [Forecast measure:] ), SUMX ( DISTINCT ( Category[Category] ), CALCULATE ( ABS ( [Ventes measure:] - [Forecast measure:] ), ALL ( 'Month'[Month No], 'Month'[Month] ) ) ) )
Jihwan_Kim
Super User
3 years agoHi,
Please check the below picture and the attached pbix file.
Ventes measure: =
CALCULATE( SUM(Data[Value]), Data[Attribute] = "Ventes")
Forecast measure: =
CALCULATE( SUM(Data[Value]), Data[Attribute] = "Forecast")
Error measure: =
IF (
ISINSCOPE ( 'Month'[Month] ),
ABS ( [Ventes measure:] - [Forecast measure:] ),
SUMX (
DISTINCT ( Category[Category] ),
CALCULATE (
ABS ( [Ventes measure:] - [Forecast measure:] ),
ALL ( 'Month'[Month No], 'Month'[Month] )
)
)
)
- Anonymous3 years agoNot applicable
Adapted the code to my needs and it worked great. Thanks