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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Nagesh20
Helper I
Helper I

Not getting total for Switch function

Hi All,

 

Please someone advice how to get the total for Max column (using with Switch function)

 

Backup calculation is given below

 

 

Nagesh20_0-1715170879843.png

 

Cumulative =
IF([TotalValue]<>BLANK(),
CALCULATE([TotalValue],
FILTER(ALL(Calender[Date]),Calender[Date]<=MAX(Calender[Date]))))
 
Max =
Var _max=maxx(filter(allselected(Table1), Table1[Product] = max(Table1[Product]) ), Table1[Date])
return
Switch ( true(),
Max(Calender[Date]) = _max ,[Cumulative],
Max(Calender[Date]) < _max , 0 ,
blank())

 

 

1 REPLY 1
v-jialongy-msft
Community Support
Community Support

Hi @Nagesh20 

 

Here are some aspects that I suggest can be considered.


1. Ensure Relationships: Make sure that there is a relationship between 'Table1[Date]'and 'Calender[Date]' if they are meant to interact. Without a proper relationship, date comparisons and aggregations might not behave as expected.

 

2. Refined Max Calculation: 

Max =
VAR _maxDateForProduct = CALCULATE(
MAX(Table1[Date]),
ALLSELECTED(Table1)
)
RETURN
SWITCH(
TRUE(),
MAX(Calender[Date]) = _maxDateForProduct, [Cumulative],
MAX(Calender[Date]) < _maxDateForProduct, 0,
BLANK()
)



 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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