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.
I need to find and select the 4 highest values of each row (amount of products per month) from the table and calculate the average, always considering the last 12 months (moving). My data is from 2016 to date, I use a date dimension table "dCalendar", "dProducts" and a sales fact table "fSales".
How could I do this by creating a measure using DAX?
P.S.: I had a (partial) solution but I have a long period of date the information returned seems inconsistent.
https://community.powerbi.com/t5/DAX-Commands-and-Tips/AVERAGE-3-HIGHEST/m-p/2060786#M46496
Best Response: VahidDM
best regards
@stericontrol , Try have measure like these, assuming you have measure amount
calculate(AverageX(Table,[amount]),TOPN(4,allselected(Date[Month Year]),[amount ],DESC), values(Date[Month Year]))
or
calculate(AverageX( values(Date[Month Year]),[amount]),TOPN(4,allselected(Date[Month Year]),[amount ],DESC))
Hello @amitchandak ,
Thanks for the answer! I need to see the top 4 average by product. How can I create this measure considering this too?
Forgive the question if it seems amateur, I'm a beginner.
best regards
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 |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
45 | |
31 | |
30 | |
18 | |
17 |