Forum Discussion

Ramachandran's avatar
Ramachandran
Helper III
4 years ago
Solved

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 

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

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

 

 

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

 

thanks,
Ram

  • Anonymous's avatar
    Anonymous
    4 years ago

    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.

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

     

    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!

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.

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

     

    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!

    • Ramachandran's avatar
      Ramachandran
      Helper III

      Hi Amit,

      I have added 0 value in below measure,

      but it not change the value. Please assist me