March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a table with Item/Product and sales. I have read a lot of the postings and I'm still stuck.
I created the following:
Measure: total demand amount = sumx('rpt salestodatemetrics', [wtd_demandamt]))
Measure: Demand Rank = Rankx(all('rpt salestodatemetrics'[itemid]), [total demand amount], ,DESC)
When I pull demand rank into table below - you can see the values are all '1'. The rpt salestodatemetrics has a count of over 7k distinct items.
Ideally, I'd like to be able to be able to create dynamic visuals that can either show our top selling or lowest selling items and what proportion % of the sales they make up.
Any help would be appreciated.
Solved! Go to Solution.
What if you include both the fields in the ALL?
Demand Rank = RANKX ( ALL ( 'rpt salestodatemetrics'[itemid],'rpt salestodatemetrics'[ItemName] ), [total demand amount], ,DESC )
Try it without the column reference in the ranking measure.
Demand Rank = RANKX ( ALL ( 'rpt salestodatemetrics' ), [total demand amount], ,DESC )
@jdbuchanan71 Thanks for that message. I tried that option and still get 1s. I'm pulling the following fields into the report.
rpt salestodatemetrics fields: [itemid], [itemname]
key measures fields: [total demand amt], [demand rank]
if i used my original code and removed [itemname] field the rank did seem to work. That lead me to try the code you mentioned and be able to place [itemname] back in the report. No luck.
I do have a filter on the report, which I hope to replace using this rankx feature of the following
[itemid] Top N of 30 by value [total demand amount]
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsWhat if you include both the fields in the ALL?
Demand Rank = RANKX ( ALL ( 'rpt salestodatemetrics'[itemid],'rpt salestodatemetrics'[ItemName] ), [total demand amount], ,DESC )
@jdbuchanan71 That seems to work. Strange that just the ALL('rpt salestodatemetrics') with no fields selected wouldn't work. That is what no fields included is supposed to mean correct?
This salestodatemetrics table is super large. It has probably over 100+ columns.
Yes, the all ( Table ) should do the same but given the size of the table you are probably better off listing the columns, otherwise the filter has to generate over every one of the columns which would be slower.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
86 | |
70 | |
51 |
User | Count |
---|---|
206 | |
150 | |
97 | |
78 | |
69 |