Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
12 | |
10 | |
10 | |
8 |
User | Count |
---|---|
16 | |
15 | |
14 | |
13 | |
10 |