Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi
I have a table with different sales dates X product , i want to put them on a visualisation matrice to have the difference between each sales date filtered by product name as showed below
I'm looking for a dax formula to calculate ''DIFFERENCE''
FILTER : Cars
| SELL DATE | DIFFERENCE |
| 13/01/2023 | |
| 14/01/2023 | 1 |
| 18/01/2023 | 4 |
| 26/01/2023 | 8 |
| 04/02/2023 | 9 |
| 07/02/2023 | 3 |
| … | … |
FILTER : Trucks
| SELL DATE | DIFFERENCE |
| 14/01/2023 | |
| 18/01/2023 | 4 |
| 19/01/2023 | 1 |
| 21/01/2023 | 2 |
| 04/02/2023 | 14 |
| 07/02/2023 | 3 |
| … | … |
Hey, you can try using
DIFFERENCE =
VAR CurrentProduct = SELECTEDVALUE('Product'[Product Name])
VAR CurrentDate = SELECTEDVALUE('Sales'[Sell Date])
RETURN
CALCULATE(
MIN('Sales'[Sell Date]) - CurrentDate,
FILTER(
ALL('Sales'),
'Sales'[Product Name] = CurrentProduct &&
'Sales'[Sell Date] < CurrentDate
)
)
Thank you. Hope this will help
Hi Thanks but this is giving me a date as result and not a number
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 53 | |
| 49 | |
| 33 | |
| 16 | |
| 15 |
| User | Count |
|---|---|
| 85 | |
| 70 | |
| 38 | |
| 28 | |
| 25 |