Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
So in other words if I apply a filter from 25/02/2023 to 08/03/2023 as in the picture the output of the measure flag A must be 0 in all rows because in the last date 08/03/2023 it does not appear, it appears flag so in the measure flag B must be 1 in all rows because in 08/03/2023 it appears as in the picture.
Result expected:
I can get the flag to change dynamically but only on the last row not all rows of all two measures, I don't know if it is possible to do that with a measure.
Thanks.
Hi,
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 )
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
8 |