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
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors