Forum Discussion
DAX Query Not working
- 1 year ago
Hi homelander123 ,
Please find the attached pbix file for your solution.
What it does below:- use ALLEXCEPT(Query1,Query1[CSMDate]) inside CALCULATE so you keep the slicer’s filter but drop everything else
- Measure - dynamically computes the prior-month window and sums PCCount across it
Please let me know if you have further questions.
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks!
Best Regards,
Maruthi
Hi homelander123 ,
Thank you for reaching out to Microsoft Fabric Community.
It addresses the key issue: the slicer is on CSMDate, but the aggregation must happen over ICMDate.
You can try to Calculate Previous Month PCCount using CSMDate Slicer:
PMPCCount =
VAR SelectedDate = MAX(Query1[CSMDate])
VAR PrevMonthStart = EOMONTH(SelectedDate, -2) + 1
VAR PrevMonthEnd = EOMONTH(SelectedDate, -1)
RETURN
CALCULATE(
SUM(Query1[PCCount]),
FILTER(
ALL(Query1),
Query1[ICMDate] >= PrevMonthStart &&
Query1[ICMDate] <= PrevMonthEnd
)
)
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you.