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.
Hi everyone,
Context : I need to display values with different aggregations in a matrix on 4 levels.
- Level 1 : raw values from a source table
- Level 2 : sum of the level 1 values by month for a location
- Level 3 : average of the level 2 values for a location
- Level 4 : average of the level 3 values (no filter, it corresponds to the bottom total line)
I face an issue in this measure :
Measure =
VAR Table1 = SUMMARIZE(Source, [LOCATIONS], [MONTH], "SumMonths", SUM(Source[Values]))
VAR Table2 = SUMMARIZE(Table1, [LOCATIONS], "AverageLocations", AVERAGE([SumMonths]))
RETURN
IF(
ISINSCOPE(Dates[Month]),
SUM(Source[Values]),
IF(
ISINSCOPE(Source[LOCATIONS]),
AVERAGEX(Table1, [SumMonths]),
AVERAGEX(Table2, [AverageLocations])
)
)
The values returned by the measure are correct in the matrix for level 1, 2 and 3 but then I have an error with the AVERAGE([SumMonths]) at the end of the second VAR. It doesn't recognize the summarized column of the Table1.
Does anyone has an idea of how this could be handled ?
Thanks in advance,
Cado
Solved! Go to Solution.
Hi @Cado_one,
You can try to use the following measure formulas if helps:
Formula =
VAR t1 =
SUMMARIZE ( Source, [LOCATIONS], [MONTH], "SumMonths", SUM ( Source[Values] ) )
VAR t2 =
SUMMARIZE (
Source,
[LOCATIONS],
"AverageLocations",
AVERAGEX (
FILTER ( t1, [LOCATIONS] = EARLIER ( Source[LOCATIONS] ) ),
[SumMonths]
)
)
RETURN
IF (
ISINSCOPE ( Dates[Month] ),
SUM ( Source[Values] ),
IF (
ISINSCOPE ( Source[LOCATIONS] ),
AVERAGEX ( t1, [SumMonths] ),
AVERAGEX ( t2, [AverageLocations] )
)
)
If the above formula also doesn't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi @Cado_one,
You can try to use the following measure formulas if helps:
Formula =
VAR t1 =
SUMMARIZE ( Source, [LOCATIONS], [MONTH], "SumMonths", SUM ( Source[Values] ) )
VAR t2 =
SUMMARIZE (
Source,
[LOCATIONS],
"AverageLocations",
AVERAGEX (
FILTER ( t1, [LOCATIONS] = EARLIER ( Source[LOCATIONS] ) ),
[SumMonths]
)
)
RETURN
IF (
ISINSCOPE ( Dates[Month] ),
SUM ( Source[Values] ),
IF (
ISINSCOPE ( Source[LOCATIONS] ),
AVERAGEX ( t1, [SumMonths] ),
AVERAGEX ( t2, [AverageLocations] )
)
)
If the above formula also doesn't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
99 | |
81 | |
77 | |
66 |
User | Count |
---|---|
134 | |
108 | |
104 | |
83 | |
73 |