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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Display different calculated measure values for different end of the month dates.

Hi All,

 

Can you please help me with the below scenario.

 

For current month end date: (29 Feb 2025)

(sum of sales where Date1 <= today()) - (sum of the sales where Date2 <= end of month today) + (sum of sales where Date2 >= end of month of today() && Date1 >= today() && Date1 <= end of month today)

 

For next month end date: (31 Mar 2025)

(sum of sales where Date1 <= today()) - (sum of the sales where Date2 <= end of month March) + (sum of sales where Date2 >= end of month of March && Date1 >= today() && Date1 <= end of month March)

 

and so on ... for every month end different calculation. It should display these values against each month end in a list or line graph.

cvaprasad2000_0-1738776547526.png

 

Thanks in advance, 

Shiva.

3 REPLIES 3
bhanu_gautam
Super User
Super User

@Anonymous Create a Date Table (if you don't already have one):

DateTable = CALENDAR(DATE(2025, 1, 1), DATE(2025, 12, 31))

 

Create Measures:

DAX
SumOfSales_Date1 = CALCULATE(SUM(Sales[Amount]), Sales[Date1] <= TODAY())

SumOfSales_Date2_EndOfMonth =
VAR EndOfMonthDate = EOMONTH(TODAY(), 0)
RETURN
CALCULATE(SUM(Sales[Amount]), Sales[Date2] <= EndOfMonthDate)

SumOfSales_Date2_Conditions =
VAR EndOfMonthDate = EOMONTH(TODAY(), 0)
RETURN
CALCULATE(
SUM(Sales[Amount]),
Sales[Date2] >= EndOfMonthDate &&
Sales[Date1] >= TODAY() &&
Sales[Date1] <= EndOfMonthDate
)

 

DAX
DynamicMeasure =
VAR CurrentMonthEnd = EOMONTH(TODAY(), 0)
VAR NextMonthEnd = EOMONTH(TODAY(), 1)
RETURN
SWITCH(
TRUE(),
SELECTEDVALUE(DateTable[Date]) = CurrentMonthEnd,
[SumOfSales_Date1] - [SumOfSales_Date2_EndOfMonth] + [SumOfSales_Date2_Conditions],
SELECTEDVALUE(DateTable[Date]) = NextMonthEnd,
[SumOfSales_Date1] - CALCULATE(SUM(Sales[Amount]), Sales[Date2] <= NextMonthEnd) +
CALCULATE(
SUM(Sales[Amount]),
Sales[Date2] >= NextMonthEnd &&
Sales[Date1] >= TODAY() &&
Sales[Date1] <= NextMonthEnd
),
-- Add more conditions for other months if needed
BLANK()
)

 

Use a line chart or a table to display the DynamicMeasure against the DateTable[Date].




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

Proud to be a Super User!




LinkedIn






Anonymous
Not applicable

Hi Bhanu, 

Thank you for your reply. But still I'm not getting the required output.

For eg, I have taken your formula and created below measure for just one simple calculation. 

 

DynamicMeasure =
VAR CurrentMonthEnd = EOMONTH(TODAY(), 0)
VAR NextMonthEnd = EOMONTH(TODAY(), 1)
RETURN
SWITCH(
TRUE(),
SELECTEDVALUE(Backlog_2[OPD]) = CurrentMonthEnd,
CALCULATE(SUM(Backlog_2[Sales]), Backlog_2[Est. Ship Date] <= EOMONTH(TODAY(),0)
))

Result:

cvaprasad2000_1-1738821729319.png

Here, the DynamicMeasure is giving 713983.87 as it is filtering for the month end 28 feb. But I need the entire calculation "[SumOfSales_Date2_EndOfMonth]" which is 13276175.28 to be stored in 28th feb 2025. 

Can you please help me.

 

Thanks,

Shiva.

Anonymous
Not applicable

Hi @Anonymous , hello bhanu_gautam, thank you for your prompt reply!

 

From your description, it seems that the original post is different from the latest post. Could you please help verify the actual requirements?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.