March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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)
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:
Dax:
Solved! Go to 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
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 ) ) )
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
)
)
)
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
Can you share your pbix file ?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |