Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
RichOB
Post Patron
Post Patron

Need help wrapping a date around a measure

Hi, I want to be able to separate 2024 and 2025 active clients into their own measures, and have 2 lines on the graph for each year. Currently, it is a continuous graph like this

 

Client.png

Here is the calculation that gets me the active clients. Some clients are active in multiple months/multiple times, and this gives me the accurate monthly figure, it was not as straightforward as a simple Count:

 

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)
)
 
Thanks!

 

 

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@RichOB To separate the active clients for 2024 and 2025 into their own measures and have two lines on the graph for each year, you can create two separate measures for each year.

 

DAX
Active Clients 2024 =
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),
YEAR('Main_Calendar'[Date]) = 2024
)

 

DAX
Active Clients 2025 =
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),
YEAR('Main_Calendar'[Date]) = 2025
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@RichOB To separate the active clients for 2024 and 2025 into their own measures and have two lines on the graph for each year, you can create two separate measures for each year.

 

DAX
Active Clients 2024 =
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),
YEAR('Main_Calendar'[Date]) = 2024
)

 

DAX
Active Clients 2025 =
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),
YEAR('Main_Calendar'[Date]) = 2025
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.