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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Conditional columns

I have a report im working on and the user wants me to add a contional column that places OVERDUE for any date that isnt the current date.  I was able to create the coulmn, but I was only able to enter a single date.  How can I tell it to change daily so that todays date would be blank and eveything after is OVERDUE?

 

Thank you

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Create a custom column in Power Query like below.

if [date]<=Date.From(DateTime.LocalNow()) then "due" else ""

7.PNG 

When you refresh the dataset, the column will be changed.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous , Are you trying to have a calculated column based on the slicer. That is not possible. You can have a measure.

Pragati11
Super User
Super User

HI @Anonymous ,

 

I understand very little of what you are trying to achieve.

Can you share some sample data or screesnhots to understand your issue easily?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Here you go I placed teh data in excel.  I removed a lot of the other data elements, but you can see what im trying to do. Basically the file refershes each day.  Uses a column in PBI called  FOLLOW UP DATE this houses dates of the files.  I wanted to build a conditional column to call out all  over due files...files that have dates prior to todays date each day so tomorrow anything marked 7/23 would now have the over due tag.

 

MS PBI.png

Hi @Anonymous ,

 

Create a custom column in Power Query like below.

if [date]<=Date.From(DateTime.LocalNow()) then "due" else ""

7.PNG 

When you refresh the dataset, the column will be changed.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

GM @v-jayw-msft 

 

Im using the code you gave me above and it works to bring back the due and over due.  Im running into an issue now that when the date field im bouncing off is empty it gives me an error in the custom column.

 

I tried removing Errors, but then it takes thoserows out of the data and we still need to see those.  How can I go about adding something telling it if the value is NULL in the date feild say blank or show a blank value in the custom column?

 

Thanks for the help in advance!

Anonymous
Not applicable

I figured if the conditon said if [RESOLVER_FOLLOW_UP_DATE]<Date.From(DateTime.LocalNow()) then "Over Due" else "Not Due" it would put that for a row that may be blank, but it doesnt and shows error for fields with no date.

Anonymous
Not applicable

Thanks this seemed to work, but 1 issue im running into is all the blanks in the query editer are coming back showing NULL, so when I refresh the data it keeps flagging those as errors.  Anything I can add in the code to make blanks blank and not say NULL?

Anonymous
Not applicable

I have files coming in to my report daily, for each file that is not the current date needs to be marked overdue.  Basically anything that is not the current date would be over due.  So today anything 7/22 and prior is over due then tomorrow anyhting 7/23 prior would be flagged and so on.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.