Forum Discussion

thinker_02's avatar
thinker_02
Regular Visitor
2 years ago
Solved

Count column, filtered by measure

I want to create a measure to count Product ID where Status on latest date is high. Product ID is a column. Status on latest date is a measure.   Snapshot of the Profit table: | Product ID |...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi thinker_02 

     

    Please try this:

    I create a new table:

    Then Create a measure:

    CountID = 
    	VAR _Newvalue = SELECTEDVALUE('Table 2'[Value])
    	VAR _countID = SWITCH(
    		_Newvalue,
    		"Count1", "ID1",
    		"Count2", "ID2"
    	)
    	RETURN
    		CALCULATE(
    			COUNTROWS('Data'),
    			FILTER(
    				ALLSELECTED('Data'),
    				'Data'[Status] = "High" && 'Data'[Product ID] = _countID
    			)
    		)

    The result is as follow:

     

    Best Regards,

    Zhengdong Xu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Ashish_Mathur's avatar
    2 years ago

    Hi,

    I had shared those measures in another post with you.  You should have ideally continued asking your question in the same thread.  Try this measure

    Measure = countrows(Data[Product ID]),[Status on latest date]="High")

    Hope this helps.