Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
bidevsugmen
Resolver I
Resolver I

Rank a measure which has three tables as data source

Hello everyone,

 

My concern-

I have three measures Measure 1, Measure 2, Measure 3 belonging to Table 1, Table 2, Table 3 respectively.

My final measure (FinalMeasure) is basically the sum of the above three measures.

 

Suppose the measure represents Quantity and has corresponding items.

 

I want to find top 10 Items with maximum value for FinalMeasure.

I tried doing this using RANKX function but the ranks are not as expected.

 

Any help is greatly appreciated.

 

Thanks in advance.

Suguna.

1 ACCEPTED SOLUTION

Hi Suguna,

 

I just copied your data and formula. It works fine. Please refer to the snapshots and the demo in the attachment. One tip: the [ItemID] in the visual should be from the ItemMaster table. 

Rank-a-measure-which-has-three-tables-as-data-source

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-jiascu-msft
Employee
Employee

Hi @bidevsugmen,

 

Could you please mark the proper answers as solutions?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Employee
Employee

Hi Suguna,

 

The measure could invoke some Tables. But a measure doesn't belong to any table. In other words, you can put it anywhere in the model.

Can you share a little sample of your data?

In your scenario, there should be a dimension table that has all the items and has relationships with the other three tables. The final visual should be the items from the dimension table and the FinalMeasure.

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Dale,

 

Kindly refer the screenshots below for sample data.

Item masterItem masterTable 1Table 1Table 2Table 2Tablle 3Tablle 3

There is one to many relationship between Item master and each of the other tables shown above.

My final measure is CALCULATE(SUM(Table1[OnHand Qty])) + CALCULATE(SUM(Table2[Ordered Qty])) - CALCULATE(SUM(Table3[OnOrder Qty]))

 

Now, i need to get top 10 items with maximum value for final measure. So i used

Rank = IF(HASONEVALUE(IItemMaster[ItemName]);RANKX(ALLSELECTED(ItemMaster);[Final Measure];;DESC))

 

IncludeTop10 = IF([Rank] <= 10; 1; 0)

 

Lastly, apply visual level filter on IncludeTop10 = 1.

 

However, this does not give the ranking as expected, in turn does not get the correct top 10 items.

 

Thanks,

Suguna.

Hi Suguna,

 

I just copied your data and formula. It works fine. Please refer to the snapshots and the demo in the attachment. One tip: the [ItemID] in the visual should be from the ItemMaster table. 

Rank-a-measure-which-has-three-tables-as-data-source

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.