Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All,
I am creating a calculated table where the data is as below. I need to calculate the distinct count of the Order column and perform ranking over it. I have the ranking figured out, but unable to create a table with GroupBy function to calculate the distinct count of the OrderNumber. Is there an alternative approach? Any help is highly appreciated.
Order Count = GROUPBY(Datasource,Datasource[City],Datasource[YEAR],Datasource[OrderType],Datasource[Order no], "Count",Distinct(CURRENTGROUP(), Datasource[Order no])))
| City | YEAR | LineType | OrderType | Order no |
| Paris | 2017 | HPLP | Pipes | 400461062 |
| Paris | 2017 | HPLP | Pipes | 400578517 |
| Paris | 2017 | HPLP | Pipes | 400663307 |
| Paris | 2017 | HPLP | Pipes | 100209055 |
| Paris | 2017 | HPLP | Pipes | 100162131 |
| Paris | 2017 | HPLP | Pipes | 400604494 |
| Paris | 2017 | HPLP | Pipes | 400466633 |
| Paris | 2017 | HPLP | Pipes | 400643457 |
| London | 2017 | HPLP | Pipes | 400634137 |
| London | 2017 | HPLP | Pipes | 400455034 |
| London | 2020 | HPLP | Pipes | 100419496 |
| London | 2020 | HPLP | Pipes | 100397579 |
| London | 2020 | HPLP | Pipes | 100436420 |
| London | 2020 | HPLP | Pipes | 401864588 |
| London | 2020 | HPLP | Pipes | 401995256 |
Solved! Go to Solution.
@Anonymous ,
You can try like
new measure
rankx(allselected(Datasource) , calculate(distinctcount(Datasource[Order no])))
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
@Anonymous ,
You can try like
new measure
rankx(allselected(Datasource) , calculate(distinctcount(Datasource[Order no])))
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
Thanks @amitchandak , I tried the GroupBy and the measure you sent, calculation works as expected. Thanks for your swift response.
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.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 40 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |