cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarkCBB
Helper V
Helper V

Name of Top 1,2,3 Stores within a tooltip

Hi There,

 

I am looking to create a DAX Measure that results in the Name of the top performing Store, 2nd Store and 3rd Store within the current filter context. so there will be 3 item in the tool tip pop up. I am just looking for the Name of the store.

 

My database is set up in a standard Star layout with the following tables:

 

Fact

Stores

Products

Calendar

 

The measure that will determine the Top 1,2,3 store is based on the Units sales. 

 

I Goal is for the user to be able to hover over a Channel (many stores are within a Channel) and the tooltip will tell them the top 1,2 and 3rd Store based on the performance of Unit sales. 

 

here is a sample set of the data: 

DATA

 

Regards,

Mark B

1 ACCEPTED SOLUTION
danextian
Community Champion
Community Champion

hi @MarkCBB,

 

I'm not sure which among the fields in your dataset pertains to the store so I just assumed it is PLACE ID.

 

I created the following measures:

sum of units = 
SUM ( 'FACT'[UNITS] )
store rank =
RANKX ( ALL ( tblCHANNEL[PLACE ID] ), [sum of units] )

I am not sure how you want to displace your top 3 in the hover so I just created two top3 measures to be used as tooltips:

top 3 =
CALCULATE (
    CONCATENATEX (
        VALUES ( tblCHANNEL[PLACE ID] ),
        tblCHANNEL[PLACE ID],
        ", " & UNICHAR ( 10 )
    ),
    FILTER ( ALL ( tblCHANNEL[PLACE ID] ), [store rank] <= 3 )
)
Top 3 (w/ order) =
VAR top1 =
    "Top 1: "
        & FILTER ( VALUES ( tblCHANNEL[PLACE ID] ), [store rank] = 1 )
        & ", "
        & UNICHAR ( 10 )
VAR top2 =
    "Top 2: "
        & FILTER ( VALUES ( tblCHANNEL[PLACE ID] ), [store rank] = 2 )
        & ", "
        & UNICHAR ( 10 )
VAR top3 =
    "Top 3: "
        & FILTER ( VALUES ( tblCHANNEL[PLACE ID] ), [store rank] = 1 )
RETURN
    top1 & top2
        & top3

I added UNICHAR(10) just in case you want to show them seperated by line breaks on a matrix (you need to turn on word wrap for value).

 

And here's one more measure if you want to show the total value of those top 3 stores:

sum of units (top 3) = 
CALCULATE (
    [sum of units],
    FILTER ( ALL ( tblCHANNEL[PLACE ID] ), [store rank] <= 3 )
)

 

The tooltip measures shoud look like this:

TOP3.png

Please don't forget to kudos or accept this post as solution if you find this helpful. 🙂




Did I answer your question? Mark my post as a solution!
"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa

View solution in original post

2 REPLIES 2
danextian
Community Champion
Community Champion

hi @MarkCBB,

 

I'm not sure which among the fields in your dataset pertains to the store so I just assumed it is PLACE ID.

 

I created the following measures:

sum of units = 
SUM ( 'FACT'[UNITS] )
store rank =
RANKX ( ALL ( tblCHANNEL[PLACE ID] ), [sum of units] )

I am not sure how you want to displace your top 3 in the hover so I just created two top3 measures to be used as tooltips:

top 3 =
CALCULATE (
    CONCATENATEX (
        VALUES ( tblCHANNEL[PLACE ID] ),
        tblCHANNEL[PLACE ID],
        ", " & UNICHAR ( 10 )
    ),
    FILTER ( ALL ( tblCHANNEL[PLACE ID] ), [store rank] <= 3 )
)
Top 3 (w/ order) =
VAR top1 =
    "Top 1: "
        & FILTER ( VALUES ( tblCHANNEL[PLACE ID] ), [store rank] = 1 )
        & ", "
        & UNICHAR ( 10 )
VAR top2 =
    "Top 2: "
        & FILTER ( VALUES ( tblCHANNEL[PLACE ID] ), [store rank] = 2 )
        & ", "
        & UNICHAR ( 10 )
VAR top3 =
    "Top 3: "
        & FILTER ( VALUES ( tblCHANNEL[PLACE ID] ), [store rank] = 1 )
RETURN
    top1 & top2
        & top3

I added UNICHAR(10) just in case you want to show them seperated by line breaks on a matrix (you need to turn on word wrap for value).

 

And here's one more measure if you want to show the total value of those top 3 stores:

sum of units (top 3) = 
CALCULATE (
    [sum of units],
    FILTER ( ALL ( tblCHANNEL[PLACE ID] ), [store rank] <= 3 )
)

 

The tooltip measures shoud look like this:

TOP3.png

Please don't forget to kudos or accept this post as solution if you find this helpful. 🙂




Did I answer your question? Mark my post as a solution!
"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa

@danextian that is exactly what I was looking for, thank you for he help. 

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!