Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello
I have a problem I have not been able to crack. I have an audit table, where I need to display different data points and highlight those data points (different columns) that have been changed, when compared to a previous row. The example data I have provided, let's sa that it consists of 4 different regions and within each of those regions there are two different products. Both of the products will be updated in the system at the same time, nevertheless if one of them was not changed (nothing can be done regarding that, the system was built like that).
| Row Number (example purpose only) | Country | Valid from | Valid until | Product | Measure1-age | Measure2 - percentage | Measure3-amount |
| 1 | Country1 | Fri, 02 Feb 2024 15:10:28 | Product1 | 18 | 0% | 5000 | |
2 | Country1 | Fri, 02 Feb 2024 15:10:28 | Product2 | 20 | 0% | 300 | |
| 3 | Country2 | Fri, 02 Feb 2024 15:10:28 | Product1 | 18 | 0% | 15000 | |
| 4 | Country2 | Fri, 02 Feb 2024 15:10:28 | Product2 | 20 | 0% | 90000 | |
| 5 | Country3 | Fri, 26 Jan 2024 09:16:40 | Product1 | 18 | 0% | 400 | |
| 6 | Country3 | Fri, 26 Jan 2024 09:16:40 | Product2 | 20 | 0% | 1000 | |
| 7 | Country4 | Thu, 25 Jan 2024 14:21:44 | Product1 | 18 | 0% | 3000 | |
| 8 | Country4 | Thu, 25 Jan 2024 14:21:44 | Product2 | 20 | 0% | 400 | |
| 9 | Country1 | Sat, 17 Sep 2022 21:53:47 | Fri, 02 Feb 2024 15:10:28 | Product1 | 18 | 10% | 5000 |
| 10 | Country1 | Sat, 17 Sep 2022 21:53:47 | Fri, 02 Feb 2024 15:10:28 | Product2 | 18 | 15% | 300 |
| 11 | Country3 | Mon, 18 Sep 2023 11:14:43 | Fri, 26 Jan 2024 09:16:40 | Product1 | 18 | 0% | 500 |
| 12 | Country3 | Mon, 18 Sep 2023 11:14:43 | Fri, 26 Jan 2024 09:16:40 | Product2 | 18 | 10% | 1200 |
| 13 | Country2 | Tue, 09 Jan 2024 12:52:01 | Fri, 02 Feb 2024 15:10:28 | Product1 | 18 | 5% | 10000 |
| 14 | Country2 | Tue, 09 Jan 2024 12:52:01 | Fri, 02 Feb 2024 15:10:28 | Product2 | 18 | 0% | 70000 |
| 15 | Country4 | Mon, 01 Jan 2024 00:00:00 | Thu, 25 Jan 2024 14:21:44 | Product1 | 18 | 0% | 3500 |
| 16 | Country4 | Mon, 01 Jan 2024 00:00:00 | Thu, 25 Jan 2024 14:21:44 | Product2 | 18 | 0% | 400 |
| 17 | Country4 | Tue, 31 Jan 2023 16:25:35 | Mon, 01 Jan 2024 00:00:00 | Product1 | 18 | 0% | 3500 |
| 18 | Country4 | Tue, 31 Jan 2023 16:25:35 | Mon, 01 Jan 2024 00:00:00 | Product2 | 16 | 2% | 400 |
| 19 | Country2 | Fri, 24 Nov 2023 10:45:53 | Tue, 09 Jan 2024 12:52:01 | Product1 | 16 | 5% | 15000 |
| 20 | Country2 | Fri, 24 Nov 2023 10:45:53 | Tue, 09 Jan 2024 12:52:01 | Product2 | 16 | 0% | 90000 |
| 21 | Country1 | Sat, 17 Sep 2022 21:56:25 | Sat, 17 Sep 2022 21:53:47 | Product1 | 18 | 10% | 8000 |
| 22 | Country1 | Sat, 17 Sep 2022 21:56:25 | Sat, 17 Sep 2022 21:53:47 | Product2 | 16 | 12% | 400 |
| 23 | Country2 | Thu, 04 May 2023 22:02:51 | Fri, 24 Nov 2023 10:45:53 | Product1 | 20 | 4% | 15000 |
| 24 | Country2 | Thu, 04 May 2023 22:02:51 | Fri, 24 Nov 2023 10:45:53 | Product2 | 20 | 2% | 90000 |
The final outcome should be something like this. All of the highlighted values, are those values that had been changed from the pervious time.
Can you help a guy out to achieve this?
Best regards!
Solved! Go to Solution.
Here's a general idea how you can do this with OFFSET
The sorting was done to check that the formula works, and can be changed back to the row number (or whatever else you are planning to sort this by.
Age Change =
var v = sum('Table'[Measure1-age])
var vp = CALCULATE(sum('Table'[Measure1-age]),OFFSET(-1,ALLSELECTED('Table'),
ORDERBY([Row Number (example purpose only)]),
PARTITIONBY('Table'[Country],'Table'[Product]),
MATCHBY('Table'[Row Number (example purpose only)])))
return if(COALESCE(vp,v)<>v,"yellow")
Here's a general idea how you can do this with OFFSET
The sorting was done to check that the formula works, and can be changed back to the row number (or whatever else you are planning to sort this by.
Age Change =
var v = sum('Table'[Measure1-age])
var vp = CALCULATE(sum('Table'[Measure1-age]),OFFSET(-1,ALLSELECTED('Table'),
ORDERBY([Row Number (example purpose only)]),
PARTITIONBY('Table'[Country],'Table'[Product]),
MATCHBY('Table'[Row Number (example purpose only)])))
return if(COALESCE(vp,v)<>v,"yellow")
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 63 | |
| 32 | |
| 31 | |
| 23 |