Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all.
I have the following scenario:
1) Users selects a daterange (lets say, 7jan-8jan)
2) I want to dynamically extract the sum of another column, two days before the minimum filter value (5jan-6jan)
For me, the hard part is that the context "hides" the data i want to sum (5jan-6jan).
I have tried A LOT of stuff, with no succes. The following example is one of the (better) attempts.
All help much appriciated!
two days before = VAR _mindate = calculate(MIN(testdata[sessiondate]),FILTER(testdata, testdata[amount]>0) RETURN CALCULATE(sum(testdata[amount]), filter(ALLEXCEPT(testdata,'Date'[date]),testdata[sessiondate]=_mindate))
Solved! Go to Solution.
Hi @Anonymous
It seems like you have a Date table already. If you're using the Date table in your slicer, try this:
two days before =
VAR _mindate =
MIN ( 'Date'[date] )
RETURN
CALCULATE (
SUM ( testdata[amount] ),
FILTER (
ALL ( 'Date' ),
'Date'[date]=_mindate - 1 || 'Date'[date]=_mindate - 2
)
)
Hi @Anonymous
It seems like you have a Date table already. If you're using the Date table in your slicer, try this:
two days before =
VAR _mindate =
MIN ( 'Date'[date] )
RETURN
CALCULATE (
SUM ( testdata[amount] ),
FILTER (
ALL ( 'Date' ),
'Date'[date]=_mindate - 1 || 'Date'[date]=_mindate - 2
)
)
Hi @AlB
Works. Thank you so much!
Yes, i have a date table that is connected to my main table. I guess my learning here, is not to forget that Power BI queries on the underlying relational structure.
Your answer is definitely accepted, but ATM i can't accept as i'm getting a "authentication failed". I'll try again tomorrow.
- Thanks again!
@Anonymous
Cool. Yeah, quite a few features at the site have not been working properly over the last days
@Anonymous
Seems like the 'mark as solution' feature is working again
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |