Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Ramachandran
Helper III
Helper III

How to show the flag value based on date range selection?

Hi,

 

I'm trying to get the flag(0/1) value based on date range selection.
For example my source data is look like 

Ramachandran_1-1644862946756.png

Suppose, I have selected date slicer between 1/1/2022 and 1/5/2022. I'm getting the result is below

Ramachandran_3-1644863028204.png

But I want to show the output is below, how will I do it?

Ramachandran_2-1644862985373.png

 

 

for your reference, I have attached .pbix file
https://drive.google.com/file/d/1TG_bL_l6gc06XjDgRmkCDgFBUrxysl29/view?usp=sharing

 

thanks,
Ram

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @Ramachandran ,

 

Try this measure.

 

Flag = 
VAR _maxdate = MAX('Calendar'[Date])
VAR _mindate = MIN('Calendar'[Date])
VAR _date = SELECTEDVALUE('SourceTbl'[Date])
RETURN
IF(_date>_maxdate||_date<_mindate,0,1)

 

Delete the relationship between the two tables.

vcgaomsft_0-1644915527402.png

The result should be like this and attach the pbix file for reference.

vcgaomsft_0-1644920849952.png

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @Ramachandran ,

 

Try this measure.

 

Flag = 
VAR _maxdate = MAX('Calendar'[Date])
VAR _mindate = MIN('Calendar'[Date])
VAR _date = SELECTEDVALUE('SourceTbl'[Date])
RETURN
IF(_date>_maxdate||_date<_mindate,0,1)

 

Delete the relationship between the two tables.

vcgaomsft_0-1644915527402.png

The result should be like this and attach the pbix file for reference.

vcgaomsft_0-1644920849952.png

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

amitchandak
Super User
Super User

@Ramachandran add +0 to your flag and try

 

example measure 

countrows(Table) +0

Hi Amit,

I have added 0 value in below measure,

Ramachandran_0-1644898757556.png

but it not change the value. Please assist me

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.