Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello
Seems simple but I need help. I need to show last day sales sum in a month as below (Last sales measure):
Measures | ||||
Year | month | Date | sales | Last sales |
2023 | 1 | 01.01.2023 | 100 | |
2023 | 1 | 02.01.2023 | 200 | |
2023 | 1 | 03.01.2023 | 300 | |
2023 | 1 | 04.01.2023 | 400 | |
2023 | 1 | 05.01.2023 | 500 | |
2023 | 1 | 06.01.2023 | 600 | |
2023 | 1 | 07.01.2023 | 700 | |
2023 | 1 | 08.01.2023 | 800 | |
2023 | 1 | 09.01.2023 | 900 | |
2023 | 1 | 10.01.2023 | 1000 | |
2023 | 1 | 11.01.2023 | 1100 | |
2023 | 1 | 12.01.2023 | 1200 | |
2023 | 1 | 13.01.2023 | 1300 | |
2023 | 1 | 14.01.2023 | 1400 | |
2023 | 1 | 15.01.2023 | 1500 | |
2023 | 1 | 16.01.2023 | 1600 | |
2023 | 1 | 17.01.2023 | 1700 | |
2023 | 1 | 18.01.2023 | 1800 | |
2023 | 1 | 19.01.2023 | 1900 | |
2023 | 1 | 20.01.2023 | 2000 | |
2023 | 1 | 21.01.2023 | 2100 | |
2023 | 1 | 22.01.2023 | 2200 | |
2023 | 1 | 23.01.2023 | 2300 | |
2023 | 1 | 24.01.2023 | 2400 | |
2023 | 1 | 25.01.2023 | 2500 | |
2023 | 1 | 26.01.2023 | 2600 | |
2023 | 1 | 27.01.2023 | 2700 | |
2023 | 1 | 28.01.2023 | 2800 | |
2023 | 1 | 29.01.2023 | 2900 | |
2023 | 1 | 30.01.2023 | 3000 | |
2023 | 1 | 31.01.2023 | 3100 | 3100 |
2023 | 2 | 01.02.2023 | 3200 | |
2023 | 2 | 02.02.2023 | 3300 | |
2023 | 2 | 03.02.2023 | 3400 | |
2023 | 2 | 04.02.2023 | 3500 | |
2023 | 2 | 05.02.2023 | 3600 | |
2023 | 2 | 06.02.2023 | 3700 | 3700 |
the model includes standard sales fact and date,product etc tables.
Thank you in advance
Leszek
Hi,
I am not sure how your datamodel looks like but please check the below picture and the attahchd pbix file.
Last sales in the month: =
VAR _lastdatenonblank =
LASTNONBLANK ( 'Calendar'[Date], CALCULATE ( SUM ( Sales[Sales] ) ) )
RETURN
CALCULATE ( SUM ( Sales[Sales] ), 'Calendar'[Date] = _lastdatenonblank )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi @Bobass75
Please try
Last Sales =
SUMX (
SUMMARIZE (
Sales,
'Date'[Year],
'Date'[Month],
"@LastSales",
VAR MaxDate =
CALCULATE ( MAX ( 'Date'[Date] ), ALL ( 'Date'[Date] ) )
RETURN
CALCULATE ( SUM ( sale[Sales] ), KEEPFILTERS ( 'Date'[Date] = MaxDate ) )
),
[@LastSales]
)
Thank you all - you've helped me a lot 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
54 | |
26 | |
20 | |
15 | |
11 |
User | Count |
---|---|
77 | |
62 | |
44 | |
17 | |
12 |