Forum Discussion

Charu's avatar
Charu
Post Patron
8 years ago

How to create Calculated column to get date values based on status in power bi

Hi Everyone,

 

please help me to create the calculated column to get the date values based on Status column values.

For example, in the table, I'm having data like below

and in power bi date slicer I need to display like below

the calculated column like = 

Datefilter = IF(datetable[Status]="YES",datetable[Startdate],datetable[EndDate])

if status is yes then from date should pick from startdate field and To date should pick the enddate column

The enddate column will always have sysdate value

 

help me how to achieve this

 

thanks inadvance

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Is it the slicer that isnt working or the calculated column ( that one looks fine ).

    I think that you need to have the calculated column set to the right data type. In this case date to be able to have the between date slicer available.


    Br,
    Gustav

    • Charu's avatar
      Charu
      Post Patron

      Hi Anonymous

       

      If I use start date filed  in date slicer it displays as 

      in To-date how to pass the end date value otherwise system date value, as I'm using direct query mode I couldn't create the custom table, now as per my requirement how to create the calculated column.

       

      whether that calculated column will filter my data if I create the relationship with other tables?

       

      Date table is one table where start date, end date, qtr, month, status presents and other tables have date column so I have created the relationship between date table and then another few tables.

       

      The Calculated column where I need to create is in the Date table 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Charu

         

        I you can suggest what is your data source, then that would help.