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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rdraytonNBRS
Frequent Visitor

Conditional Sum based on Date

Hi All,

 

I have two fields (one "Revenue" and the other "WeightedAmt"), both of which have a relationship to a MonthEnd date field as per tables below.
rdraytonNBRS_0-1685064530450.png

I want to create a conditional measure that will return the Revenue field for all months incl last calendar month before today, but will return the WeightedAmt field for the current calendar month and future months.

Any help would be appreciated.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rdraytonNBRS ,

calculate(sum(Table[Revenue]), filter(Date, Date[Date]<=eomonth(today(),-1) ) )

 

or

calculate(sum(Table[Revenue]), filter(all(Date), Date[Date]<=eomonth(today(),-1) ) ) // use allselected if needed

 

for WeightedAmt 

 

calculate(sum(Table[WeightedAmt ]), filter(Date, Date[Date]> eomonth(today(),-1) ) )

 

or

calculate(sum(Table[WeightedAmt ]), filter(all(Date), Date[Date]> eomonth(today(),-1) ) ) // use allselected if needed

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@rdraytonNBRS ,

calculate(sum(Table[Revenue]), filter(Date, Date[Date]<=eomonth(today(),-1) ) )

 

or

calculate(sum(Table[Revenue]), filter(all(Date), Date[Date]<=eomonth(today(),-1) ) ) // use allselected if needed

 

for WeightedAmt 

 

calculate(sum(Table[WeightedAmt ]), filter(Date, Date[Date]> eomonth(today(),-1) ) )

 

or

calculate(sum(Table[WeightedAmt ]), filter(all(Date), Date[Date]> eomonth(today(),-1) ) ) // use allselected if needed

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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