cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
bidevsugmen Regular Visitor
Regular Visitor

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

Accepted Solutions
Community Support Team
Community Support Team

Re: Rank a measure which has three tables as data source

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.
4 REPLIES 4
Community Support Team
Community Support Team

Re: Rank a measure which has three tables as data source

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.
bidevsugmen Regular Visitor
Regular Visitor

Re: Rank a measure which has three tables as data source

Hi Dale,

 

Kindly refer the screenshots below for sample data.

image.pngItem masterimage.pngTable 1image.pngTable 2image.pngTablle 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.

Community Support Team
Community Support Team

Re: Rank a measure which has three tables as data source

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.
Community Support Team
Community Support Team

Re: Rank a measure which has three tables as data source

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.