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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

How to Calculate specific values in a filter

Good Morning, 

Apologies if this has been answered. 

 

I am looking to only calculate values that I specifically highlight within my filter. Currently the below code will calculate between 15th-19th how do it make so it only calculates the 15th & 19th ?

 

finno14_0-1652946867933.png

 

 

 

Bank_holiday_After = 

var _max1 = MAXX(ALLSELECTED(First_Period_Comparison),First_Period_Comparison[Date])

var Help=  MINx(ALLSELECTED(First_Period_Comparison),First_Period_Comparison[Date])


return 
CALCULATE([Incidents_Fri_Mon],FILTER('Alex Date Period Flow','Alex Date Period Flow'[Date]>=  Help &&'Alex Date Period Flow'[Date]<= _max1))

 

 Kind regards,

AF

1 ACCEPTED SOLUTION

Isn't it just the ">=" and "<=" that needs to be replaces with just "="
And "&&" with "||"

  

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @amitchandak ,

 

Thanks for this, I have inputted as per below but im still encountering the same issue. Ideally the Bank_holiday_after total would =  2052 as opposed to the current 7437

 

finno14_0-1652965571567.png

 

 

Bank_holiday_After = 

var _max = MAXX(ALLSELECTED(First_Period_Comparison),First_Period_Comparison[Date]) -- Comparison Date Table

var _min=  MINx(ALLSELECTED(First_Period_Comparison),First_Period_Comparison[Date]) -- Comparison Date Table


return 
CALCULATE([Incidents_Fri_Mon],FILTER('Alex Date Period Flow','Alex Date Period Flow'[Date]>=  _min &&'Alex Date Period Flow'[Date]<= _max)) -- Main Date Table

 

Thank you for your help,

 

AF

Isn't it just the ">=" and "<=" that needs to be replaces with just "="
And "&&" with "||"

  

Anonymous
Not applicable

Of course it is! Mind blank! Thank you!! @NickolajJessen 

amitchandak
Super User
Super User

@Anonymous , for the table in slicer, need to be an independent table

 

example

//Date1 is independent Date table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = minx(allselected(Date1),Date1[Date])
return
calculate( sum(Table[Value]), filter('Table', 'Table'[Date] >=_min && 'Table'[Date] <=_max))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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