Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I would appreciate help with the next problem.
I created the following measure because I need the quantity of sales for the last 30 days.
sales_quantity_last_30_days = CALCULATE(DISTINCTCOUNT(sales[id]),DATESINPERIOD ( Calendario[Date], TODAY(), -30, DAY ))
The problem is that I have a slicer to filter the dates that worked fine if I used if I looked at the quantity of total sales (not just the last 30 days). But when using the created measure, it is not affected by the slicer.
And I would like the slicer to affect the measure created so that it shows sales for the previous 30 days based on the last day filtered in the slicer.
I upload a dummy table where I show the situation of my measurements and how the slicer affects the measure counting the total sales and not the other that counts just the last 30 days:
https://drive.google.com/drive/folders/1TOYezhAuiy0ADTNcKVL1ayNw5XoLMo_I?usp=sharing
Thanks in advance!
Solved! Go to Solution.
Can you pleas try the following:
Formula =
var __Today = TODAY()
var __StartDay = __Today - 30
Return
CALCULATE(
DISTINCTCOUNT(sales[id]),
DATESBETWEEN ( Calendario[Date], __StartDay, __Today)
)
It could be that you need to calculate -29 isntead of -30 depending on your logic
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
This keeps the measure in the same way, without being affected by the slicer.
This worked. Thank you!
User | Count |
---|---|
15 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
18 | |
15 | |
7 | |
5 |