Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I need to create a report. I have 2 reports to create in mind, i.e.
1. To display the comparison of average YTD and average value from 1-Jan-17 to Monday last week
2. To display the comparison of average YTD and average value within last 1 week period
To be more efficient, I'm thinking of providing a slicer for the period of time used to calculate the 2nd value in #1 & #2 points above.
I'm not sure whether this is possible or not. Any advise on it and the formula to used is welcomed.
Thanks.
Solved! Go to Solution.
Hi @RMV,
Suppose source table contains two columns [Sales Date] and [Sales].
You can refer to below measure formulas to calculate average in different period.
Average YTD = TOTALYTD ( AVERAGE ( 'Sales table'[Sales] ), 'Sales table'[Sales Date] ) Average to last Monday = TOTALYTD ( AVERAGE ( 'Sales table'[Sales] ), 'Sales table'[Sales Date], FILTER ( 'Sales table', 'Sales table'[Sales Date] <= TODAY () - ( WEEKDAY ( TODAY () - 2 ) + 7 ) ) ) Average last week = CALCULATE ( AVERAGE ( 'Sales table'[Sales] ), FILTER ( 'Sales table', WEEKNUM ( 'Sales table'[Sales Date], 2 ) = WEEKNUM ( TODAY (), 2 ) - 1 ) )
If you want to dynamically show average based on slicer selection, you need to create an extra table which lists all selection items like this. Later, we should add this column into slicer.
Create a measure
Average = IF ( LASTNONBLANK ( 'Slicer Table'[Period selection], 1 ) = "Last Monday", [Average to last Monday], [Average last week] )
Result.
Best regards,
Yuliana Gu
Hi @RMV,
Have you worked it out? If so, would you please mark the corresponding reply as an answer or share your resolution so that it can benefit others having similar requirements?
Regards,
Yuliana Gu
Hi @v-yulgu-msft,
Actually my question is to have a flexible start date & end date to filter 1 calculation, and does not effect the other calculation.
Thus, when a side-by-side bar is created using the calculation, 1 bar will have a fix filter (i.e. YTD average) & the other bar will be effected by the start date &/ end date filter applied.
Any advise please?
Hi @RMV,
Sorry for my misunderstanding.
Unfortunately, I don't think this is available to achieve such a requirement. The filter will apply to all bars in a chart. This is by default.
Regards,
Yuliana Gu
Hi @RMV,
Suppose source table contains two columns [Sales Date] and [Sales].
You can refer to below measure formulas to calculate average in different period.
Average YTD = TOTALYTD ( AVERAGE ( 'Sales table'[Sales] ), 'Sales table'[Sales Date] ) Average to last Monday = TOTALYTD ( AVERAGE ( 'Sales table'[Sales] ), 'Sales table'[Sales Date], FILTER ( 'Sales table', 'Sales table'[Sales Date] <= TODAY () - ( WEEKDAY ( TODAY () - 2 ) + 7 ) ) ) Average last week = CALCULATE ( AVERAGE ( 'Sales table'[Sales] ), FILTER ( 'Sales table', WEEKNUM ( 'Sales table'[Sales Date], 2 ) = WEEKNUM ( TODAY (), 2 ) - 1 ) )
If you want to dynamically show average based on slicer selection, you need to create an extra table which lists all selection items like this. Later, we should add this column into slicer.
Create a measure
Average = IF ( LASTNONBLANK ( 'Slicer Table'[Period selection], 1 ) = "Last Monday", [Average to last Monday], [Average last week] )
Result.
Best regards,
Yuliana Gu
Hi @v-yulgu-msft,
In another case of my original question, I'm interested with your calculation to have slicer options of measure to be viewed.
Can I use the same concept to create a chart?
Tried once and it didn't succeed.
Regards,
viyona
User | Count |
---|---|
141 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |