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 guys.
I am trying to display values for a 5 day rolling period for data that has a value (AA, BB or CC). I calculated the 5-day rolling sum using:
Solved! Go to Solution.
Hi,
According to your description, i create a sample to test:
Then create a seperate date slicer table:
DateSlicer = DISTINCT(SELECTCOLUMNS('Table',"Date",'Table'[transDate]))
Create a new category table by Enter Data:
Then try this measure:
Measure =
SWITCH (
SELECTEDVALUE ( 'New Category'[New Category] ),
"AA Rolling 5 Day", CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Category] = "AA"
&& 'Table'[transDate]
>= SELECTEDVALUE ( DateSlicer[Date] ) - 5
&& 'Table'[transDate] <= SELECTEDVALUE ( DateSlicer[Date] )
)
),
"BB Rolling 5 Day", CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Category] = "BB"
&& 'Table'[transDate]
>= SELECTEDVALUE ( DateSlicer[Date] ) - 5
&& 'Table'[transDate] <= SELECTEDVALUE ( DateSlicer[Date] )
)
),
"CC Rolling 5 Day", CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Category] = "CC"
&& 'Table'[transDate]
>= SELECTEDVALUE ( DateSlicer[Date] ) - 5
&& 'Table'[transDate] <= SELECTEDVALUE ( DateSlicer[Date] )
)
)
)
When you select one value in seperate date slicer, it shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto
Hi,
According to your description, i create a sample to test:
Then create a seperate date slicer table:
DateSlicer = DISTINCT(SELECTCOLUMNS('Table',"Date",'Table'[transDate]))
Create a new category table by Enter Data:
Then try this measure:
Measure =
SWITCH (
SELECTEDVALUE ( 'New Category'[New Category] ),
"AA Rolling 5 Day", CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Category] = "AA"
&& 'Table'[transDate]
>= SELECTEDVALUE ( DateSlicer[Date] ) - 5
&& 'Table'[transDate] <= SELECTEDVALUE ( DateSlicer[Date] )
)
),
"BB Rolling 5 Day", CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Category] = "BB"
&& 'Table'[transDate]
>= SELECTEDVALUE ( DateSlicer[Date] ) - 5
&& 'Table'[transDate] <= SELECTEDVALUE ( DateSlicer[Date] )
)
),
"CC Rolling 5 Day", CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Category] = "CC"
&& 'Table'[transDate]
>= SELECTEDVALUE ( DateSlicer[Date] ) - 5
&& 'Table'[transDate] <= SELECTEDVALUE ( DateSlicer[Date] )
)
)
)
When you select one value in seperate date slicer, it shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto
HI @sthandiwe ,
There is already a thread for similar kind of issue as follows:
https://community.powerbi.com/t5/Desktop/Rolling-5-days-back/m-p/827160
try modifying your DAX expression to the one mentioned in this thread.
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |