Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
henninghafr
Contributor
Contributor

Find matching dimensional value to a calculated measure

Hi,

In a table I have a list of movies with a unique "%Key_object_id" that also have a "price". These movies are spread across multiple "providers" and multiple providers will have certain movies, sometimes with the same price, sometimes not.

I have created a measure which shows the highest an lowest price: 

aggr(max(price),%Key_object_id)

aggr(min(price),%Key_object_id)

and I am trying to find a way to match this value with the "provider" dimensional value so I can have two columns where I get the name of the provider with the highest and lowest price.  If there a a couple that share the highest or lowest price I would like to have it concatenated and separated by a comma. 

Could anyone help me in the right direction?

Cheers Henning

 

8 Replies
Anil_Babu_Samineni

If i understand correctly from your description, May be use this?

FirstSortedValue([name of the provider], aggr(max(price),%Key_object_id))) & ' - ' & aggr(max(price),%Key_object_id)

FirstSortedValue([name of the provider], aggr(min(price),%Key_object_id))) & ' - ' & aggr(min(price),%Key_object_id)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

May be try this

Concat(Aggr(
    If(Max(TOTAL price) = price, providers)
, %Key_object_id, providers), ', ')

and

Concat(Aggr(
    If(Min(TOTAL price) = price, providers)
, %Key_object_id, providers), ', ')
henninghafr
Contributor
Contributor
Author

thanks this works perfect except for one thing. The values (the providers have the lowest resp. highest prices) only show up when I click on a specific title. If I do not click, they look like null values? Any ideas?

sunny_talwar

What exactly is a title here? I am not sure I understand?

henninghafr
Contributor
Contributor
Author

Hi again! 

When I look at all titles it looks like a null value , but when I press on one of the titles I get the correct answer (see below)

sunny_talwar

May be this.. add Title to Aggr() function's dimension

Concat(Aggr(
    If(Max(TOTAL price) = price, providers)
, %Key_object_id, providers, Title), ', ')

and

Concat(Aggr(
    If(Min(TOTAL price) = price, providers)
, %Key_object_id, providers, Title), ', ')

 

henninghafr
Contributor
Contributor
Author

hi again, still no luck but will continue trying! 

Cheers Henning

sunny_talwar

I am a little confused... would you be able to share a sample where we can see the issue?