Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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!
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
25 | |
18 | |
18 | |
17 | |
17 |
User | Count |
---|---|
33 | |
25 | |
18 | |
15 | |
13 |