Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I am trying create a sum of sales prior period dax measure based on current slicer date range selction.
for eg: my Slicer date range is April 20 - 7 may, days between this date range is 17 , I want a measure which goes 17 days behind from start date (April 20 ). I.e; April 3rd to 19 April
it should display some thing like this
Really appreiate your help. Thank you!
Solved! Go to Solution.
Hi @Bhanuaripaka ,
You can refer to below demo.
Demo - Immediately Prior focus period measure.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
You can refer to below measure.
Measure =
VAR CurDate = MAX('Date'[Date])
VAR Slicer_Start = CALCULATE(MIN('Date'[Date]),ALLSELECTED())
VAR Slicer_End = CALCULATE(MAX('Date'[Date]),ALLSELECTED())
VAR N = Slicer_End-Slicer_Start
RETURN
CALCULATE(
SUM('Sales'[Quantity]),
'Date'[Date]=CurDate-N-1
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
You can refer to it.
Measure =
VAR Slicer_Start = CALCULATE(MIN('Date'[Date]),ALLSELECTED())
VAR Slicer_End = CALCULATE(MAX('Date'[Date]),ALLSELECTED())
VAR N = Slicer_End-Slicer_Start
RETURN
SUMX(
VALUES('Date'[Date]), // Use the Row label Field of Matrix
VAR CurDate = 'Date'[Date]
RETURN
CALCULATE(
SUM('Sales'[Quantity]),
'Date'[Date]=CurDate-N-1,
ALL ('Time Granularity Table')
)
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Hi @Bhanuaripaka ,
You can refer to below demo.
Demo - Immediately Prior focus period measure.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Hi. Just wanted to check wheather is there way to build a immediate prior period logic which overlay on current period selection ?
Currently it shows like this
is there way can we do like below ?
Appreciate your thoughts.
You can refer to below measure.
Measure =
VAR CurDate = MAX('Date'[Date])
VAR Slicer_Start = CALCULATE(MIN('Date'[Date]),ALLSELECTED())
VAR Slicer_End = CALCULATE(MAX('Date'[Date]),ALLSELECTED())
VAR N = Slicer_End-Slicer_Start
RETURN
CALCULATE(
SUM('Sales'[Quantity]),
'Date'[Date]=CurDate-N-1
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Hi again. Measure is working exactly as expected but total is incorrect, can you please help me to fix it. Total of Measure should be 563 but it was showing 139.
I have tried using SUMX and SUMMARIZE but not luck.
Thanks for you time.
You can refer to it.
Measure =
VAR Slicer_Start = CALCULATE(MIN('Date'[Date]),ALLSELECTED())
VAR Slicer_End = CALCULATE(MAX('Date'[Date]),ALLSELECTED())
VAR N = Slicer_End-Slicer_Start
RETURN
SUMX(
VALUES('Date'[Date]), // Use the Row label Field of Matrix
VAR CurDate = 'Date'[Date]
RETURN
CALCULATE(
SUM('Sales'[Quantity]),
'Date'[Date]=CurDate-N-1,
ALL ('Time Granularity Table')
)
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Many thanks again.
Perfect,Thank you so much.
It worked, thanks much for your help.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
19 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
25 | |
10 | |
10 | |
9 | |
6 |