Forum Discussion
czaldumbide
2 years agoHelper II
Add Ranking Column with filters
Hi Everyone, I need some help creating an index column using DAX. I have a table named ACCOUNTEXCEPTION with columns [ID] , [Key] and [Status]. I first want to create a ranking column, that sort...
- 2 years ago
Hi,
Please check the below picture and the attached pbix file.
Order by key CC = VAR _firstid = MINX ( FILTER ( ACCOUNTEXCEPTION, ACCOUNTEXCEPTION[Key] = EARLIER ( ACCOUNTEXCEPTION[Key] ) ), ACCOUNTEXCEPTION[ID] ) VAR _condition = COUNTROWS ( FILTER ( ACCOUNTEXCEPTION, ACCOUNTEXCEPTION[Key] = EARLIER ( ACCOUNTEXCEPTION[Key] ) && ACCOUNTEXCEPTION[ID] = _firstid && ACCOUNTEXCEPTION[Status] = "Research" ) ) = 1 RETURN IF ( _condition, SUMX ( FILTER ( ACCOUNTEXCEPTION, ACCOUNTEXCEPTION[Key] = EARLIER ( ACCOUNTEXCEPTION[Key] ) && ACCOUNTEXCEPTION[ID] <= EARLIER ( ACCOUNTEXCEPTION[ID] ) ), 1 ) )
Jihwan_Kim
2 years agoSuper User
Hi,
Please check the below picture and the attached pbix file.
Order by key CC =
VAR _firstid =
MINX (
FILTER (
ACCOUNTEXCEPTION,
ACCOUNTEXCEPTION[Key] = EARLIER ( ACCOUNTEXCEPTION[Key] )
),
ACCOUNTEXCEPTION[ID]
)
VAR _condition =
COUNTROWS (
FILTER (
ACCOUNTEXCEPTION,
ACCOUNTEXCEPTION[Key] = EARLIER ( ACCOUNTEXCEPTION[Key] )
&& ACCOUNTEXCEPTION[ID] = _firstid
&& ACCOUNTEXCEPTION[Status] = "Research"
)
) = 1
RETURN
IF (
_condition,
SUMX (
FILTER (
ACCOUNTEXCEPTION,
ACCOUNTEXCEPTION[Key] = EARLIER ( ACCOUNTEXCEPTION[Key] )
&& ACCOUNTEXCEPTION[ID] <= EARLIER ( ACCOUNTEXCEPTION[ID] )
),
1
)
)czaldumbide
2 years agoHelper II
Thanks for the solution. This worked perfectly.