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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
i want to calucaluate the previous month count using below exp not working fine
my Date field is Calendar_date and values are 01-Apr-20 like that
this is my DB view ,. Vw_fact_AIS_9R_SPECIFIC_SHIPMENT_REPORT
Solved! Go to Solution.
Hello,
I am pretty sure that it only works with a dimension date table, so using this table your expression would be like the following:
Prev Month count = CALCULATE([SKU_Count],dateadd(dim_date[.Calendar_date],-1,MONTH))
@Anonymous , not sure the name of date in date table, one of the following
CALCULATE([SKU_Count],dateadd(dim_date[Calendar_date],-1,MONTH))
CALCULATE([SKU_Count],dateadd(dim_date[Date],-1,MONTH))
CALCULATE([SKU_Count],DATESMTD(dateadd(dim_date[Date],-1,MONTH)))
@Anonymous , Use Date calendar
Prev Month count = CALCULATE([SKU_Count],dateadd(Date[Date],-1,MONTH))
MTD Sales = CALCULATE([SKU_Count],DATESMTD('Date'[Date]))
Last month= CALCULATE([SKU_Count],previousmonth('Date'[Date]))
last MTD Sales = CALCULATE([SKU_Count],DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales = CALCULATE([SKU_Count],DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.
m getting below error.
Hello,
I am pretty sure that it only works with a dimension date table, so using this table your expression would be like the following:
Prev Month count = CALCULATE([SKU_Count],dateadd(dim_date[.Calendar_date],-1,MONTH))
thnk you . i dont have dim table i have only one main table
how to modify the exp?
CALCULATE([SKU_Count],dateadd(dim_date[.Calendar_date],-1,MONTH))
@Anonymous , not sure the name of date in date table, one of the following
CALCULATE([SKU_Count],dateadd(dim_date[Calendar_date],-1,MONTH))
CALCULATE([SKU_Count],dateadd(dim_date[Date],-1,MONTH))
CALCULATE([SKU_Count],DATESMTD(dateadd(dim_date[Date],-1,MONTH)))
Hi
i dont have date table ..
i have only main table.
@Anonymous - See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |