Forum Discussion
DAX Query Not working
I Want to calculate the count however the issue is that my slicer is based out of CSMDate and i want to calculate For ICMdate. This query isnt giving me any results. Can you please help?
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
6 Replies
- homelander123Helper IPMPCCount =VAR SelectedMonth = MAX(Query1[CSMDate])RETURNCALCULATE(SUM(Query1[PCCount]),Query1[ICMDate] >= EOMONTH(SelectedMonth, -2) + 1 && Query1[ICMDate] <= EOMONTH(SelectedMonth, -1))
I also tried this but it didnt work - v-venuppuCommunity Support
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.
- maruthispSuper User
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
- v-venuppuCommunity Support
Hi homelander123 ,
Thank you maruthisp for the Prompt Response.
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you
- v-venuppuCommunity Support
Hi homelander123 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
- v-venuppuCommunity Support
Hi homelander123 ,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.
Thank you.