Forum Discussion

WJ_WJ's avatar
WJ_WJ
Regular Visitor
2 years ago

Count selected IDs with filtering removed

Hi,

 

Data like this: 

 

creates a matrix like this;

 

and when ckicked a table like this:

I want to create a measure that counts the IDs 2 or 3 for the different date and stage, so I can visualise it like this:

 

In DAX I can use the following code, but struggle how to define the VAR selected_ids dynamically. I tried to use VALUES on the [ID], but it selects alll the possible IDs. 

 

 

Thanx!

 

7 Replies

    • WJ_WJ's avatar
      WJ_WJ
      Regular Visitor

      Thx for your reply, but Im looking for  a fully DAX solution. Should be possible...

      • Anonymous's avatar
        Anonymous
        Not applicable

        I'm not sure why you'd always want just id 2 and 3, you could use a slicer for a dynamic selection but if you want it hardcoded try:

        Test = 

        VAR _table = FILTER('stagesTbl',

                                         'stagesTbl'[id] = 2 || 'stagesTbl'[id] = 3)

        RETURN

        COUNTX(_table, COUNT('stagesTbl'[id]))