Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have Sales table data with Geo,Manager,Employee and Salesamount column and based on this columns i want to calculate measure which display Rank of all emp ,Rank of Emp by Mgr, Rank of Emp by Geo and display data in table only for top 25 employee by Sales amount.
I have below measure for this scenrio but it is working only in metrix not in table
EmployeeRank =
var SalesAmount = calculate( SalesData[SalesAmount],SalesData[Type] = "Won")
var top25SalesAmount =
Thanks for update but rather than power query can we handle by using separate measure
It is better to create calculate columns in Power Query if possible but as you wish:
Result:
Don't forget to change table name form Query1 to your table name.
Emp
Rank of Emp = RANKX(Query1, [SalesAmount])
Emp by Manger
Rank of Emp by Mgr =
VAR _mng = Query1[Manager]
VAR _result =
RANKX(
FILTER(Query1, [Manager] = _mng),
[SalesAmount]
)
RETURN _result
Emp by Geo
Rank of Emp by Geo =
VAR _geo = Query1[Geo]
VAR _result =
RANKX(
FILTER(Query1, [Geo] = _geo),
[SalesAmount]
)
RETURN _result
Hi @Kishorb,
Power Query solution:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc9NC4MwDAbg/9Kzh7pPPTo9DTeGU/zCQ2kHlokFrbD9+yU5lPXyJjwJoe17lrCANQ1EMr0+UELO2RD8eb5JsUKNY9/vQr+RI8dtC/EQs9IWB2caXKCta4jntmjkk88F7H/Rj+QptF2H69JYOnPwPR0XvVq6tPcnVzPOyDvHRQFxEwu9MyTOoC1LDKMUMndcVfT8bYISxY7zHD+rpUGGzw4/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Geo = _t, Manager = _t, Employee = _t, SalesAmount = _t]),
ChangedType = Table.TransformColumnTypes(Source,{{"SalesAmount", type number}}),
SortedRows = Table.Sort(ChangedType,{{"SalesAmount", Order.Descending}}),
Ad_RankOfEmp = Table.AddIndexColumn(SortedRows, "Rank of Emp", 1, 1, Int64.Type),
GroupedRows1 = Table.Group(Ad_RankOfEmp, {"Manager"}, {{"RankEmpMgr", each Table.AddIndexColumn(_, "Rank of Emp by Mgr", 1, 1 , Int64.Type), type table}}),
CombinedTables1 = Table.Combine(GroupedRows1[RankEmpMgr]),
GroupedrRows2 = Table.Group(CombinedTables1, {"Geo"}, {{"RankEmpGeo", each Table.AddIndexColumn(_, "Rank of Emp by Geo", 1, 1 , Int64.Type), type table}}),
CombinedTables2 = Table.Combine(GroupedrRows2[RankEmpGeo])
in
CombinedTables2
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
41 | |
30 | |
26 | |
21 | |
17 |