Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
The upper table is the result i want. So for "lichaamssamenstelling" I want a result of 7.63 in the left column second table. My calculation works as you can see in the third column. Why is this not working in the folowing function?
Kolom =
IF (
webgraph[Category] = "Lichaamssamenstelling",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[BodyComp2] ) )
),
IF (
webgraph[Category] = "cardio",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[cardio2] ) )
),
IF (
webgraph[Category] = "Microcirculatie",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[Micro2] ) )
),
IF (
webgraph[Category] = "stress",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[stress2] ) )
),
IF (
webgraph[Category] = "Vertebraal",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[Vert2] ) )
),
0
)
)
)
)
)
In my opinion the calculation is identical to the quick calculation in the 3th column:
Gemiddelde van BodyComp2 per LastValue =
AVERAGEX(
KEEPFILTERS(VALUES('calctable'[LastValue])),
CALCULATE(AVERAGE('calctable'[BodyComp2]))
)
Solved! Go to Solution.
Hi @DionTN
Do you mean "Quick measure" by "quick calculation"? Your [Kolom] is a calculated column rather than a measure, so the measure DAX will work differently when it's applied to a calculated column. You can try below code to create a measure and add it to the table visual to check the result.
New Measure =
IF (
SELECTEDVALUE ( webgraph[Category] ) = "Lichaamssamenstelling",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[BodyComp2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "cardio",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[cardio2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "Microcirculatie",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[Micro2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "stress",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[stress2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "Vertebraal",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[Vert2] ) )
),
0
)
)
)
)
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @DionTN
Do you mean "Quick measure" by "quick calculation"? Your [Kolom] is a calculated column rather than a measure, so the measure DAX will work differently when it's applied to a calculated column. You can try below code to create a measure and add it to the table visual to check the result.
New Measure =
IF (
SELECTEDVALUE ( webgraph[Category] ) = "Lichaamssamenstelling",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[BodyComp2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "cardio",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[cardio2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "Microcirculatie",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[Micro2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "stress",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[stress2] ) )
),
IF (
SELECTEDVALUE ( webgraph[Category] ) = "Vertebraal",
AVERAGEX (
KEEPFILTERS ( VALUES ( 'calctable'[LastValue] ) ),
CALCULATE ( AVERAGE ( 'calctable'[Vert2] ) )
),
0
)
)
)
)
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
@DionTN , Try a measure like
Gemiddelde van BodyComp2 per LastValue =
CALCULATE(AVERAGEX(VALUES('calctable'[LastValue]),
CALCULATE(AVERAGE('calctable'[BodyComp2]))
), allselected())
I need to change the Kolom calculation cause that result is not correct where i expect 7.63.
Now I tried your example but it still gives 7.31:
Kolom =
IF (
webgraph[Category] = "Lichaamssamenstelling",
CALCULATE (
AVERAGEX (
VALUES ( 'calctable'[LastValue] ),
CALCULATE ( AVERAGE ( 'calctable'[BodyComp2] ) )
),
ALLSELECTED ()
),
0
)
User | Count |
---|---|
98 | |
78 | |
77 | |
49 | |
26 |