Forum Discussion
Youness99
3 years agoFrequent Visitor
Help Flag on column
I am trying to create 2 measures one for flag a and another for flag b, and these measures have to change based on the date range filtered and the appearance of all two flags in the recent date. ...
Jihwan_Kim
Super User
3 years agoHi,
I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Flag A measure expected outcome: =
VAR _slicerlastdate =
CALCULATE ( MAX ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar'[Date] ) )
VAR _flagAdate =
FILTER ( ALL ( 'Calendar'[Date] ), CALCULATE ( MAX ( Data[Flag A] ) ) = "A" )
RETURN
IF (
HASONEVALUE ( 'Calendar'[Date] ),
IF ( _slicerlastdate IN _flagAdate, 1, 0 )
)
Flag B measure expected outcome: =
VAR _slicerlastdate =
CALCULATE ( MAX ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar'[Date] ) )
VAR _flagAdate =
FILTER ( ALL ( 'Calendar'[Date] ), CALCULATE ( MAX ( Data[Flag B] ) ) = "B" )
RETURN
IF (
HASONEVALUE ( 'Calendar'[Date] ),
IF ( _slicerlastdate IN _flagAdate, 1, 0 )
)