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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Alizee
Frequent Visitor

How to highlight unmatching data based on date fields from different tables

Hello,

 

I have two different tables : Placements and Invoices and basically, the goal of the report is to highlight placements that does not have an invoice on a given month despite the fact that the month in question is between the start and end date of the placement.

For example, in the below are displayed data from the two tables. Both are connected through the Placement ID (Item Code in the Invoice table).

help1.PNG

The right table shows the placements ID and matching invoices dates for February and the left table shows all placements that should technically be in it since the start date is before February and the end date after.

I don't know how I should do to highlight the following in a conditional formating way:
- If the chosen month is between the Start Date and End Date of a given placement and there is an Invoice Date for this placement (meaning there has been an invoice for the month), then GREEN.

- If the chosen month is between the Start Date and End Date of a given placement BUT there is no Invoice Date for this placement (meaning there has not been an invoice for the month), then RED.

- If there is an invoice Date for a given placement but the invoice date is not within the start date and end date of the placement, then ORANGE.

Thank you for your help!

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Alizee 

 

You may first download the attached PBIX to see whether this is close to what you want. 

vjingzhang_0-1650265019146.png

I created two measures in the report. The first measure is to play as a visual-level filter on the left table so the table will only show placements whose date begin dates are earlier than the selected month and date end dates are after the selected month. 

Date Flag = IF(SELECTEDVALUE('Placement Table'[Date Begin])<MIN('Date'[Date])&&SELECTEDVALUE('Placement Table'[Date End])>MAX('Date'[Date]),1,0)

The second measure is to decide colors for different scenarios. I didn't consider the scenario with ORANGE color as currently the left table show placements whose (start date ~ end date) range can cover the selected month. As a result the placements that meet the third condition will not show. 

Color = 
VAR _itemCodes = VALUES('Invoice Table'[Item Code])
RETURN
SWITCH(TRUE(),SELECTEDVALUE('Placement Table'[Placement ID]) IN _itemCodes, "GREEN","RED")

 

If you want to show the third condition placements in the left table, I'll remove the first measure filter on it and modify the color measure. Let me know your expected result. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Alizee 

 

You may first download the attached PBIX to see whether this is close to what you want. 

vjingzhang_0-1650265019146.png

I created two measures in the report. The first measure is to play as a visual-level filter on the left table so the table will only show placements whose date begin dates are earlier than the selected month and date end dates are after the selected month. 

Date Flag = IF(SELECTEDVALUE('Placement Table'[Date Begin])<MIN('Date'[Date])&&SELECTEDVALUE('Placement Table'[Date End])>MAX('Date'[Date]),1,0)

The second measure is to decide colors for different scenarios. I didn't consider the scenario with ORANGE color as currently the left table show placements whose (start date ~ end date) range can cover the selected month. As a result the placements that meet the third condition will not show. 

Color = 
VAR _itemCodes = VALUES('Invoice Table'[Item Code])
RETURN
SWITCH(TRUE(),SELECTEDVALUE('Placement Table'[Placement ID]) IN _itemCodes, "GREEN","RED")

 

If you want to show the third condition placements in the left table, I'll remove the first measure filter on it and modify the color measure. Let me know your expected result. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hello @v-jingzhang ,

 

Thank you so much for your reply, it really was the solution I was looking for in terms of the first part of the problem!

 

As for the ORANGE color code, it is a filter I would actually like to add to the right table (the invoice table) to highlight the invoice dates for placements that are not within the right time range.

E.g, if I am selecting February 2022, thanks to your filters, the left table will highlight all placements within the range and color-filter them based on if they have an invoice or not. But I would also like to highlight in the right table in orange the invoice date/placement id that do not match any of the placements shown for february. Do you know how I could do it? Would it be through a conditional formating measure as well?

 

Thank you again for your help, it really cleared the issue for me/

 

Kind Regards,

Alizée

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.