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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
tksnota
Post Patron
Post Patron

RAG Status Based Based On Invoice Date

Hi,

 

I need help to show an item in RAG based on due date using terms like 30, 45 or 60 days after invoice date.

 

Example: Red = 1 day after invoice, Amber = 5 days before Invoice date and Green more than 5 days.

 

Thanks

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

Hi @tksnota ,

 

Thanks for the reply from @lbendlin .

 

Here is the sample data I created:

User ID

Invoice Date

A1

5/29/2024

A2

5/31/2024

A3

5/1/2024

A4

4/28/2024

A5

5/17/2024

A6

2/28/2024

A7

5/9/2024

 

Assuming 30 days due, create a calculated column to represent the due date corresponding to the invoice date.

Due Date = 'Table'[Invoice Date] + 30

 

Create a calculated column to determine the RAG status.

RAG = 
VAR CurrentDate = TODAY()
VAR DaysToDueDate = DATEDIFF(CurrentDate,'Table'[Due Date], DAY)
RETURN
SWITCH(
    TRUE(),
    DaysToDueDate = 1, "Red",
    DaysToDueDate <= -5 , "Amber",
    DaysToDueDate >= 5, "Green"
)

Set conditional formatting:

vhuijieymsft_0-1717728895164.png

vhuijieymsft_1-1717728895167.png

 

As you can see, the Amber color cannot be recognized and can be replaced with other colors.

 

The final page effect is as follows:

vhuijieymsft_2-1717728904487.png

 

I would be grateful if you could provide me with the pbix file or sample data.

 

Remember to remove sensitive data and do not log in to your account in Power BI Desktop when uploading the pbix file.

 

If you have any other questions please feel free to contact me.

 

The pbix file is attached.

 

Best Regards,
Yang
Community Support Team

 

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

2 REPLIES 2
v-huijiey-msft
Community Support
Community Support

Hi @tksnota ,

 

Thanks for the reply from @lbendlin .

 

Here is the sample data I created:

User ID

Invoice Date

A1

5/29/2024

A2

5/31/2024

A3

5/1/2024

A4

4/28/2024

A5

5/17/2024

A6

2/28/2024

A7

5/9/2024

 

Assuming 30 days due, create a calculated column to represent the due date corresponding to the invoice date.

Due Date = 'Table'[Invoice Date] + 30

 

Create a calculated column to determine the RAG status.

RAG = 
VAR CurrentDate = TODAY()
VAR DaysToDueDate = DATEDIFF(CurrentDate,'Table'[Due Date], DAY)
RETURN
SWITCH(
    TRUE(),
    DaysToDueDate = 1, "Red",
    DaysToDueDate <= -5 , "Amber",
    DaysToDueDate >= 5, "Green"
)

Set conditional formatting:

vhuijieymsft_0-1717728895164.png

vhuijieymsft_1-1717728895167.png

 

As you can see, the Amber color cannot be recognized and can be replaced with other colors.

 

The final page effect is as follows:

vhuijieymsft_2-1717728904487.png

 

I would be grateful if you could provide me with the pbix file or sample data.

 

Remember to remove sensitive data and do not log in to your account in Power BI Desktop when uploading the pbix file.

 

If you have any other questions please feel free to contact me.

 

The pbix file is attached.

 

Best Regards,
Yang
Community Support Team

 

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!

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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