Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Dear Community,
please help to figure out why my expression not working as expected
Sum of Product = CALCULATE(SUM(Table[Product]),Date=OR(FIRSTDATE(Table[Date]),LASTDATE(Table[Date]))
formula keep to return all sum values in a selected date range.
| Source | ||
| Date | Product | Qty |
| 01-02-18 | A | 2 |
| 01-02-18 | B | 5 |
| 01-02-18 | B | 6 |
| 03-02-18 | A | 7 |
| 03-02-18 | A | 9 |
| 03-02-18 | B | 2 |
| 06-02-18 | A | 6 |
| 06-02-18 | A | 7 |
| 06-02-18 | B | 9 |
And Expected result
| A | B | |
| 01-02-18 | 2 | 11 |
| 06-02-18 | 13 | 9 |
Solved! Go to Solution.
Hi slyfox ,
To achieve your requirement, you can create a measure and use DAX below:
Result = CALCULATE(AVERAGE('Table'[Qty]), FILTER('Table', ('Table'[Date] = MIN('Table'[Date]) || 'Table'[Date] = MAX('Table'[Date])) && 'Table'[Date] = EARLIER('Table'[Date]) && 'Table'[Product] = EARLIER('Table'[Product])))
PBIX here: https://www.dropbox.com/s/am1wnov5mng3u4i/First%20and%20Last%20date.pbix?dl=0
Regards,
Jimmy Tao
Hi slyfox ,
To achieve your requirement, you can create a measure and use DAX below:
Result = CALCULATE(AVERAGE('Table'[Qty]), FILTER('Table', ('Table'[Date] = MIN('Table'[Date]) || 'Table'[Date] = MAX('Table'[Date])) && 'Table'[Date] = EARLIER('Table'[Date]) && 'Table'[Product] = EARLIER('Table'[Product])))
PBIX here: https://www.dropbox.com/s/am1wnov5mng3u4i/First%20and%20Last%20date.pbix?dl=0
Regards,
Jimmy Tao
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 30 | |
| 29 | |
| 25 | |
| 23 | |
| 16 |
| User | Count |
|---|---|
| 45 | |
| 32 | |
| 17 | |
| 16 | |
| 16 |