Forum Discussion

Roy_tap's avatar
Roy_tap
Icon for Helper I rankHelper I
1 year ago
Solved

How 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 ...
  • Roy_tap's avatar
    Roy_tap
    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])

        RETURN
            COUNTX(
                CALCULATETABLE(
                FILTER(VALUES('Table 1'[Resource]),
                [Measure Value]=_Value
                )),
            [Measure value]
            )

    Anyway thanks for the proposed solution.