Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
I have a Table of three columns for the last 3 years, [Sale][Date][Category]
I am looking for a DAX which picks up the best(Highest) performer and worst (Least) performer by Category based on Sales for the Last 12 months
If I use Card on Visualisation part, I should be able to show in Two Cards (Best and lowest PErformer )
Solved! Go to Solution.
@heygowtam , First create a rolling 12 month measure
Rolling 12 = CALCULATE(sum(Sales[Sales]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
then use TOPN to get
TOP1 Category = CALCULATE(max('Sales'[Category]) TOPN(1,ALLSELECTED('Sales'[Category]), [Rolling 12 ],DESC), values('Sales'[Category]))
Bottom Category = CALCULATE(max('Sales'[Category]) TOPN(1,ALLSELECTED('Sales'[Category]), [Rolling 12 ],asc ), values('Sales'[Category]))
Rolling Months Formula: https://youtu.be/GS5O4G81fww
TOPN: https://youtu.be/QIVEFp-QiOk
@heygowtam , First create a rolling 12 month measure
Rolling 12 = CALCULATE(sum(Sales[Sales]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
then use TOPN to get
TOP1 Category = CALCULATE(max('Sales'[Category]) TOPN(1,ALLSELECTED('Sales'[Category]), [Rolling 12 ],DESC), values('Sales'[Category]))
Bottom Category = CALCULATE(max('Sales'[Category]) TOPN(1,ALLSELECTED('Sales'[Category]), [Rolling 12 ],asc ), values('Sales'[Category]))
Rolling Months Formula: https://youtu.be/GS5O4G81fww
perferct, jsut there is a comma missing before TOPN. Thats all
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 52 | |
| 44 | |
| 44 | |
| 20 | |
| 19 |
| User | Count |
|---|---|
| 72 | |
| 70 | |
| 34 | |
| 33 | |
| 31 |