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 all,
Given the following sample data, along with a timeline slicer which I can select Months such as Jan-Mar, Feb-Apr, Jan-Apr
Month | Customer | Sales |
January | A | 10 |
January | B | 23 |
January | C | 34 |
February | A | 12 |
February | B | 31 |
February | C | 29 |
March | A | 9 |
March | B | 17 |
March | C | 13 |
April | A | 21 |
April | B | 13 |
April | C | 14 |
How do I use Rankx() or a suitable measure to generate the following visual?
For timeline Jan-Mar
Customer | Total Sales for Period Selected | Rank at Starting Month of Period Selected | Current Rank - Rank at Latest Month of Period Selected |
A | 31 | 3 | 3 |
B | 71 | 2 | 1 |
C | 76 | 1 | 2 |
Here, Starting Month of Period Selected = Jan
Latest Month of Period Selected = Mar
Any advise is greatly appreciated
Solved! Go to Solution.
Hi @Anonymous ,
You could use Max() and Min() function to calculate the value of max month and min month of time period.
minvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MIN('Table'[month])))
maxvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MAX('Table'[month])))
Then use RANKX() function to rank the values.
Best Regards,
Jay
Hi @Anonymous ,
You could use Max() and Min() function to calculate the value of max month and min month of time period.
minvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MIN('Table'[month])))
maxvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MAX('Table'[month])))
Then use RANKX() function to rank the values.
Best Regards,
Jay
are you using text for the dates or can you provide the data with proper dates?
Proud to be a Super User!
Dear @vanessafvg,
The dates are in the proper date/time format in the original dataset.
I summarized it according to the month name just for the sample data provided above
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 | |
100 | |
86 | |
64 |