The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi Team,
Previously, thanks for help.
I have to calculate previous month sales but in day wise. For example, if today's date is 29th June 2022 then previous month sales come only 1st May 2022 to 29th May 2022.
I have used the below formula:
Previous month sales = CALCULATE(SUM(tableA[Sales]), DATEADD(DATESMTD("calcnder'[date]), -1, MONTH))
But, this formula is showing till 31-may-2022 sales.
Please help me on this
Thanks
Shipra
Hi @Anonymous ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Measure =
SUMX(
ALLSELECTED('Table'),'Table'[Amount])
Flag =
var _today=TODAY()
var _date1=DATE(YEAR(_today),MONTH(_today)-1,1)
var _date2=DATE(YEAR(_today),MONTH(_today)-1,DAY(_today))
return
IF(
MAX('Table'[Date])>=_date1&&MAX('Table'[Date])<=_date2,1,0)
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
If you need pbix, please click here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
User | Count |
---|---|
14 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
13 | |
8 | |
5 |