Forum Discussion
Need help adding a date range to a measure
- 1 year ago
Hello RichOB
Active_Clients :=
VAR CurrentMonthStart = MIN('Main_Calendar'[Date])
VAR CurrentMonthEnd = MAX('Main_Calendar'[Date])
RETURN
CALCULATE(
COUNTROWS('Table'),
'Table'[Start_Date] <= CurrentMonthEnd,
OR(
ISBLANK('Table'[End_Date]),
'Table'[End_Date] >= CurrentMonthStart
)
)
Active_Clients_FY_2024_25 :=
CALCULATE(
[Active_Clients],
'Main_Calendar'[Date] >= DATE(2024, 4, 1),
'Main_Calendar'[Date] <= DATE(2025, 3, 31)
)
Active_Clients_FY_2023_24 :=
CALCULATE(
[Active_Clients],
'Main_Calendar'[Date] >= DATE(2023, 4, 1),
'Main_Calendar'[Date] <= DATE(2024, 3, 31)
)
Place 'Main_Calendar'[Month] (or a similar month/year field) on the x-axis.
Add both Active_Clients_FY_2024_25 and Active_Clients_FY_2023_24 as values for comparison
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
Hi RichOB,
Thank you for reaching out to the Microsoft fabric community forum. Thank you pankajnamekar25, for your inputs on this issue.
After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.
Active clients Dax:
Active_Clients =
CALCULATE(
COUNTROWS('Clients'),
'Clients'[Start_Date] <= MAX('Main_Calendar'[Date]),
OR(
ISBLANK('Clients'[End_Date]),
'Clients'[End_Date] >= MIN('Main_Calendar'[Date])
)
)
Active_Clients_FY_2024 Dax:
Active_Clients_FY_2024 =
CALCULATE(
[Active_Clients],
FILTER(
'Main_Calendar',
'Main_Calendar'[Date] >= DATE(2023,4,1) &&
'Main_Calendar'[Date] <= DATE(2024,3,31)
)
)
Active_Clients_FY_2025 Dax:
Active_Clients_FY_2025 =
CALCULATE(
[Active_Clients],
FILTER(
'Main_Calendar',
'Main_Calendar'[Date] >= DATE(2024,4,1) &&
'Main_Calendar'[Date] <= DATE(2025,3,31)
)
)
Relationship:
Output:
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
- v-kpoloju-msft1 year ago
Community Support
Hi RichOB,
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.