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
ViralPatel212
Resolver I
Resolver I

Remove Date filter in Dax (ignore date filter)

Hi Team,

 

Wondering if you could help - may be a simple dax edit but i can't see. I have a Previous month measure where it calcuates the Vol size and shows the last month summed value.

 

Problem: When a person selects a period from the date field. (Sept -Dec) the LAst month measure does a calulation which is correct its not what i am trying to achieve. (showing 982,180.93) (Aug-Nov)

ViralPatel212_0-1706261369282.png

 

Result: I am trying to make that column/measure static that if some chooses a date filter the measure should ignore it and present the previous month based on Today. Acheive result should be (210,700.89) as im in month Jan 24.

 

Filter  slicer is coming from a Date table with a relationship to Dealer Ranking (Trade Date) 

 

Here is how is looks:

ViralPatel212_0-1706260657456.png

Dax:

 

1) Ranking Size (Vol) previous month =

IF([Ranking Size (Vol)] = BLANK(),BLANK(),

 IF([Ranking Size (Vol)]> 0,
CALCULATE([Ranking Size (Vol)],
PARALLELPERIOD('DIM Calendar (test)'[Date],-1,MONTH))
))
 
2) Ranking Size (Vol) =
    CALCULATE([Ranking Size], 'Dealer Ranking'[Type] = "Vol. (MM)")
 
3) Ranking Size =
    SUM('Dealer Ranking'[Size])
 
 
thanks
 
1 ACCEPTED SOLUTION

Hi @AmiraBedh  

Thank you for the quick response.

However when i do that. I get a blank data returned?? my table that i need result its broken by a Category so for J.P.Morgan it should show 210,700.89

 

 

ViralPatel212_0-1706274009662.png

 

View solution in original post

4 REPLIES 4
ViralPatel212
Resolver I
Resolver I

@AmiraBedh 

I was able to figure it out. Had to create two  for the below dax. My model has got a date table and a custom date table (last 5 day, lasy 7 days, 40 days etc.) so jus changed the dates from the dax to look at the dates and used bookmarks to populate it.

 

But do you think i could have this in a switch? i.e if 1 filter is selected show measure 2 else if the other show measure 1??

 

VAR CurrentDate = TODAY()
VAR StartOfCurrentMonth = STARTOFMONTH('DIM Calendar (test)'[Date])
VAR StartOfPreviousMonth = EDATE(StartOfCurrentMonth, -1)
VAR EndOfPreviousMonth = EOMONTH(StartOfPreviousMonth, 0)
RETURN
IF(
    [Ranking Size (Vol)] = BLANK(), 
    BLANK(), 
    IF(
        [Ranking Size (Vol)] > 0,
        CALCULATE(
            [Ranking Size (Vol)],
            ALL('DIM Calendar (test)'),
            'DIM Calendar (test)'[Date] >= StartOfPreviousMonth,
            'DIM Calendar (test)'[Date] <= EndOfPreviousMonth
        )
    )
)

 

AmiraBedh
Super User
Super User

You need to use ALL() :

Ranking Size (Vol) previous month =
VAR CurrentDate = TODAY()
VAR StartOfCurrentMonth = STARTOFMONTH('DIM Calendar (test)'[Date])
VAR StartOfPreviousMonth = EDATE(StartOfCurrentMonth, -1)
VAR EndOfPreviousMonth = EOMONTH(StartOfPreviousMonth, 0)
RETURN
IF(
    [Ranking Size (Vol)] = BLANK(), 
    BLANK(), 
    IF(
        [Ranking Size (Vol)] > 0,
        CALCULATE(
            [Ranking Size (Vol)],
            ALL('DIM Calendar (test)'),
            'DIM Calendar (test)'[Date] >= StartOfPreviousMonth,
            'DIM Calendar (test)'[Date] <= EndOfPreviousMonth
        )
    )
)

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Hi @AmiraBedh  

Thank you for the quick response.

However when i do that. I get a blank data returned?? my table that i need result its broken by a Category so for J.P.Morgan it should show 210,700.89

 

 

ViralPatel212_0-1706274009662.png

 

Can you share your pbix file ?

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

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.