Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare 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.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
91 | |
86 | |
76 | |
66 |
User | Count |
---|---|
149 | |
117 | |
111 | |
106 | |
95 |