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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Ackbar-Learner
Resolver I
Resolver I

How to get a measure to ignore date filter in a visual and use other dates?

Hi

 

I am having a very specific issue. So, i have a date between type slicer on my visual. Based on the selections of that slicer, i created two measures for the first and last date known as Board10aFirstDateSelected and Board10aLastDateSelected.

 

Now,  i want to ignore the dates selected in the slicer but using the above 2 measures, i created another First and Last date as in below DAX code:

Board10bP&LAllTransactionAmountwithSignBudgetActualized = 
VAR First = if(today()>[Board10aFirstDateSelected],today(),[Board10aFirstDateSelected])
VAR Last = if(today()>[Board10aLastDateSelected],[Board10aLastDateSelected],today())
RETURN
CALCULATE(
    [AmountWithSign],
    FILTER(ALL(BudgetCalendar[Date]),DATESBETWEEN(BudgetCalendar[Date],First,Last))
)

I want to ignore the actual date filter on the visual and return the values using the new 2 dates named as First and Last in above code but it is returning blank as it seems it did not remove the filter as intended in above DAX code.

 

Thanks for any kind of help.

1 ACCEPTED SOLUTION
Ackbar-Learner
Resolver I
Resolver I

Hi @Anonymous 

Thanks. I figured it out. The actual issue was on the VAR First and VAR Last dax codes

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)
)

 This is the correct DAX.

 

However, when using ALL, it is returning the total data in each date hierarchy level. Any idea how to summarize that by date hierarchy? I looked for Summarizecolumns but don't know how to use that!

View solution in original post

2 REPLIES 2
Ackbar-Learner
Resolver I
Resolver I

Hi @Anonymous 

Thanks. I figured it out. The actual issue was on the VAR First and VAR Last dax codes

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)
)

 This is the correct DAX.

 

However, when using ALL, it is returning the total data in each date hierarchy level. Any idea how to summarize that by date hierarchy? I looked for Summarizecolumns but don't know how to use that!

Anonymous
Not applicable

Hello @Ackbar-Learner I think a simple removefilter([date]) in the calculate formula will do the trick

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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