Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
I want to create a DAX formula for the following query. The year and month is dynamic, user can select it from the slicer. Can you please help on this.
Solved! Go to Solution.
hi, @Anonymous
For your case, I think you need a separate Year-Month table, and don't create the relationship with IMOT table.
Then adjust your formula
Return CALCULATE( C, filter(sd_IMOT,sd_IMOT[Dispatch Closing Date_IMOT] >= D && sd_IMOT[Year-Month_IMOT] < D ))
Then it should work, If not your case, please share some sample data and your expected out.
Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Best Regards,
Lin
Please refer
Sales Days = (
VAR _Cuur_start = Min('Compare Date'[Compare Date])
VAR _Curr_END = Max('Compare Date'[Compare Date])
return
calculate(sum(Sales[Sales Amount]),Sales[Sales Date] >= _Cuur_start && Sales[Sales Date] <= _Curr_END )
)
But in my scenario, I want to filter based on two date columns - Dispatch-Closing-Date and Year-Month.
But calculate function is accepting only one condition.
I tried the following formula.
hi, @Anonymous
For your case, I think you need a separate Year-Month table, and don't create the relationship with IMOT table.
Then adjust your formula
Return CALCULATE( C, filter(sd_IMOT,sd_IMOT[Dispatch Closing Date_IMOT] >= D && sd_IMOT[Year-Month_IMOT] < D ))
Then it should work, If not your case, please share some sample data and your expected out.
Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Best Regards,
Lin
Creating separate table worked. Thanks bro.
But this filtering is not happening, when am selecting Year-Month value from the slicer. Instead of the calaculation, its showing amount belongs to that particular Year-Month.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 76 | |
| 37 | |
| 31 | |
| 27 | |
| 27 |