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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

Hi @Anonymous ,

 

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
Anonymous
Not applicable

Hi @Anonymous ,

 

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.