Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi All,
I got stuck with a DAX measure.
I need to calculate the Current Month's sales and the Previous Month's sales. Both the measures are working perfectly if nothing is selected in the date or month slicer. when I select a month in the slicer then the Previous Month's sales measure is giving a blank.
For example, if I select "June" in the slicer table then the Current Month's sales measure should be of June and the Previous Month's sales measure should be of May.
My measure are given below:
Current Month Sales =
TOTALMTD (
SUM ( 'Dataset supply chain'[total sale] ),
DATESMTD ( 'Dataset supply chain'[Order date] ))
Previous Month Sales =
CALCULATE (
SUM ( 'Dataset supply chain'[total sale] ),
PREVIOUSMONTH ( DATESMTD ( 'Dataset supply chain'[Order date] ) ))
I am also attaching screenshots of the results.
Looking forward to a solution.
Thanks,
Sid
Multiple columns cannot be converted to a scalar value
Thanks, it works.
One more question regarding the same visual. how i can calculate the TOP 5 products (by sales) of the Current Month and the Top 5 products (by sales) of the Previous Month? I am trying the above measures with the TOPN function but it is giving me error.
Please do let me know if anyone here helps me how to solve this
Hello , any solution for this query?
What is the error message ?
Firstly, create a proper date table and link it to your fact table. Then you can create measures like
Current Month Sales =
TOTALMTD ( SUM ( 'Dataset supply chain'[total sale] ), 'Date'[Date] )
Previous Month Sales =
CALCULATE (
SUM ( 'Dataset supply chain'[total sale] ),
PREVIOUSMONTH ( 'Date'[Date] )
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
10 | |
10 | |
9 | |
8 |
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
8 |