Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
Hello All ,
Here is my DAX measure - that return blank results.. Im trying just to get Previous month sales :
Solved! Go to Solution.
Hi @SammyBM - I have tested the sample data, Can you please try below measure and let us know.
Hope it helps.
Proud to be a Super User! | |
Hi @SammyBM ,
Here is my sample data:
I don't know if there is a relationship between your Calendar table and the Hashavshvet table, so I used a DAX that works fine with or without the relationship:
salePreviousMonth =
VAR _PreviousMonth = PREVIOUSMONTH('Calendar'[MonthYear])
VAR SalesAmount = CALCULATE(
SUM(Hashavshvet[sales]),
FILTER(
ALL(Hashavshvet),
Hashavshvet[SortCodeName] = "test" &&
Hashavshvet[FullName] = "meals" &&
Hashavshvet[AccountKey] = "800" && YEAR('Hashavshvet'[MonthYear]) = YEAR(_PreviousMonth) && MONTH('Hashavshvet'[MonthYear]) = MONTH(_PreviousMonth)
)
)
RETURN SalesAmount
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Dino , Something is weired. I know how to use time intl formulas, But somthing is getting wrong in my DAX - I've tried your suggsetion ( both calendar and hashavshvet connected via Date colum. But yet i can get previous month sales - Here my error :
"... A table of multiple values was suplied where s single value was expected "
Hi @SammyBM - I have tested the sample data, Can you please try below measure and let us know.
Hope it helps.
Proud to be a Super User! | |
Hi @SammyBM -As per above formaule shared, slight modification as below
I hope you already have a calendar table in your model
salePreviousMonth =
VAR _PreviousMonth = PREVIOUSMONTH('Calendar'[Date]) // Assuming 'Date' is your calendar date column
RETURN
CALCULATE(
SUM(Hashavshvet[sales]),
FILTER(
Hashavshvet,
Hashavshvet[SortCodeName] = "test" &&
Hashavshvet[FullName] = "meals" &&
Hashavshvet[AccountKey] = "800" &&
Hashavshvet[Date] IN _PreviousMonth // Ensure that you use the actual date field here
)
)
Hope it works, if still any please share sample data in text for further analysis.
Proud to be a Super User! | |
Thank you for the support !
The calendar table is set by month year interval , as the customer only wants to look on monthly data. so the monthyear is date.
i've tried your solution but is still bringing blank values.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
73 | |
70 | |
70 | |
45 | |
41 |
User | Count |
---|---|
49 | |
47 | |
30 | |
28 | |
27 |