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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Ackbar-Learner
Resolver I
Resolver I

Reinsert filter after using ALL in a measure

Hi

Below dax code first removes the date filter from the visual and calculates data based on other dates from measures. This returns the total amount from First to Last.

Board10bP&LAllTransactionAmountwithSignBudgetActualized = 
VAR First = if(and(TODAY()>=[Board10aFirstDateSelected], TODAY()>= [Board10aLastDateSelected]),[Board10aLastDateSelected]+1,if(and(TODAY()<[Board10aFirstDateSelected], TODAY()< [Board10aLastDateSelected]),[Board10aFirstDateSelected],TODAY()+1))
VAR Last = CALCULATE(MAX( BudgetCalendar[Date] ),ALL( BudgetCalendar ))
RETURN
CALCULATE(
    [AmountWithSign],
    ALL(BudgetCalendar[Date]),DATESBETWEEN(BudgetCalendar[Date],First,Last)
)

 The issue is that i want this total data still to be summarized by the date hierarchy (year, quarter, month) in the visual. I tried my hand at Summarizecolumns but i have not grasped that yet.

 

Thanks in advance for a kind help.

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Ackbar-Learner 

you may try:

Board10bP&LAllTransactionAmountwithSignBudgetActualized =
VAR First = if(and(TODAY()>=[Board10aFirstDateSelected], TODAY()>= [Board10aLastDateSelected]),[Board10aLastDateSelected]+1,if(and(TODAY()<[Board10aFirstDateSelected], TODAY()< [Board10aLastDateSelected]),[Board10aFirstDateSelected],TODAY()+1))
VAR Last = CALCULATE(MAX( BudgetCalendar[Date] ), ALL( BudgetCalendar[Date] ))
RETURN
CALCULATE(
[AmountWithSign],
ALL(BudgetCalendar[Date]),DATESBETWEEN(BudgetCalendar[Date],First,Last)
)

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

hi @Ackbar-Learner 

you may try:

Board10bP&LAllTransactionAmountwithSignBudgetActualized =
VAR First = if(and(TODAY()>=[Board10aFirstDateSelected], TODAY()>= [Board10aLastDateSelected]),[Board10aLastDateSelected]+1,if(and(TODAY()<[Board10aFirstDateSelected], TODAY()< [Board10aLastDateSelected]),[Board10aFirstDateSelected],TODAY()+1))
VAR Last = CALCULATE(MAX( BudgetCalendar[Date] ), ALL( BudgetCalendar[Date] ))
RETURN
CALCULATE(
[AmountWithSign],
ALL(BudgetCalendar[Date]),DATESBETWEEN(BudgetCalendar[Date],First,Last)
)

Thanks a lot. It worked! It was infront of me and i could never see it 😀

Ackbar-Learner
Resolver I
Resolver I

@amitchandak Hi Amit, maybe you could help on above. Thanks.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.