Forum Discussion
Roy_tap
Helper I
1 year agoHow to apply Countif based on measure value
Hi, I have currently 2 tables as follows Table 1 (Multiple Side filter apply to get the measure value) Year Resource Measure Value 2024 A 1 2024 B 2 2024 C 0 2024 D 0 ...
- 1 year ago
The measure is not returning anything. i am actually having a complex measure that doesnt reside inside Table 1, so i need to use calculatetable to store the Resource and Measure within the same object before countx.
var _Value = SELECTEDVALUE('Table 2'[Column1])RETURNCOUNTX(CALCULATETABLE(FILTER(VALUES('Table 1'[Resource]),[Measure Value]=_Value)),[Measure value])
Anyway thanks for the proposed solution.
Irwan
Super User
1 year agohello Roy_tap
please check if this accomodate your need.
since you are mentioned about measure, i assumed you want to do this in measure form.
1. create a new measure with following DAX
Measure Countif =
var _Value = SELECTEDVALUE('Table 2'[Column1])
Return
COUNTX(
FILTER(
'Table 1',
'Table 1'[Measure Value]=_Value
),
'Table 1'[Measure Value]
)
Hope this will help.
Thank you.
Roy_tap
Helper I
1 year agoThe measure is not returning anything. i am actually having a complex measure that doesnt reside inside Table 1, so i need to use calculatetable to store the Resource and Measure within the same object before countx.
var _Value = SELECTEDVALUE('Table 2'[Column1])
RETURN
COUNTX(
CALCULATETABLE(
FILTER(VALUES('Table 1'[Resource]),
[Measure Value]=_Value
)),
[Measure value]
)
Anyway thanks for the proposed solution.
Anyway thanks for the proposed solution.