Trying to achieve the below, but have not been successful in creating a combined DAX ...
Use filter in PowerBI to select product(s)
Then in table have products & a column with …
'Average sales rate for the latest 4weeks' =
Want to have the SUM of 'units' by 'location ID', for the filtered values (example filtered by products)
For the latest 4 weeks, which are based upon the latest date in the table, irrespective of filtering
Have that averaged out by 4 weeks
IF for a resulting 'location ID' there are no 'units', then show 0 value, for that specific 'location ID'
Then average the prior calculated 4 week average for all the 'location ID' where resulting unit values > 0
Example data table below
Go to Solution.
Below should work if I understood your requirement correctly 🙂
Create below three measures--
View solution in original post
This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149The pattern is: MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])etc.
You can add FILTERs
Proud to be a Super User!
Are you trying to compare the units sold of the selected product to the averge units sold for the product at the current location for the prior 4 weeks or across all locations for the prior 4 week?
Bit of a WAG but this measure should get you the Rolling 4 Week Avg based on what you have in your filter, and rows
Rolling 4 Weeks Sales Avg =
filter(ALL('Table'[Week Start]),'Table'[Week Start] in DATESINPERIOD('Table'[Week Start], max('Table'[Week Start] ), -28, DAY ))
Hope this Helps a little,
Did I answer your question? Mark my post as a solution!Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
Check out the on demand sessions that are available now!
Check out the Winners!
Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.