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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
sabedin
Helper I
Helper I

Top visited category description

I need help with the attached file. Please download it and see.

 

I need a calculated column in 'Member_event_facts' table. I need it to show the top visited category name (club_event_groups[naam]) for every member_id. 

 

diagram.jpg

 

pbix file here

 

Thank you

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@sabedin

 

Hi, try this:

Top Visit Category =
VAR RankingContext =
    VALUES ( Club_event_groups[naam] )
RETURN
    CALCULATE (
        FIRSTNONBLANK ( Club_event_groups[naam]; Club_event_groups[naam] );
        TOPN ( 1; ALL ( Club_event_groups[naam] ); [Total visits] );
        RankingContext
    )

Regards

Victor




Lima - Peru

View solution in original post

7 REPLIES 7
v-yuta-msft
Community Support
Community Support

Hi sabedin,

 

Relationship between table 'Member_Club_Events' and table 'Member_Event_Facts' is many to many, so it's difficult to achieve [naam] value based on Member_Id using some function(e.g.: related()). You should do some modification on the table structure between the three tables to make the relationship between table Member_club_events, Members and Member_event_facts, for example, you can merge table Members with Member_club_events using right ourter join and then create a one-to-many relationship between 'merged table' and 'Member_Event-facts'.

捕获.PNG 

 

Hope it's helpful to you.

 

Jimmy Tao

Hi Jimmy, thanks for replying.

 

Please check the calculated column Top Selling Category, with this I was able to get the Count of most visited category. Maybe you can you modify it somehow so we get the actual name (naam) not the Count.

 

Top Selling Category = 

VAR
    RankingContext = values(Club_event_groups[naam])
Return
CALCULATE([Total visits],
     TOPN(1,all(Club_event_groups[naam]),[Total visits]),
     RankingContext)

 

Thanks again!

Anyone, please?

Sorry to bother Mr@MattAllington, Can you please have a look at this?

 

Thank you!

Vvelarde
Community Champion
Community Champion

@sabedin

 

Hi, try this:

Top Visit Category =
VAR RankingContext =
    VALUES ( Club_event_groups[naam] )
RETURN
    CALCULATE (
        FIRSTNONBLANK ( Club_event_groups[naam]; Club_event_groups[naam] );
        TOPN ( 1; ALL ( Club_event_groups[naam] ); [Total visits] );
        RankingContext
    )

Regards

Victor




Lima - Peru

Great, thanks a lot Senjor Victor 🙂

sabedin
Helper I
Helper I

Anyone please help!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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