The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi I have a measure that counts the total active clients, I want to show this month over month in a line graph but also compare it against last year.
How do I make 2 separate measures using the measure below and the dates here?:
01/04/2024 to 31/03/2025?
01/04/2023 - 31/03/2024
I have a separate "Main Calendar" as a date table with the date in dd/mm/yy.
Here's my existing measure:
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[Start_Date), Table[Start_Date] >= CurrentMonthStart)
)
Thanks
Solved! Go to Solution.
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 | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
Hi,
Share some data to work with and show the expected result. Share data in a format that can be pasted in an MS Excel file.
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.
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.
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 | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
Hi @pankajnamekar25, thanks for your reply. The measures worked to get the individual annual numbers, but for some reason, when they are in a graph with the month on the X axis, it doesn't work.
The top graph is the original measure with the same month selection for the X axis as the graph below. Would you know why this is happening?