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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ppatil
Helper III
Helper III

top 3 record in table

refer below table

SEGMENT CATEGORY SUB_CATEGORY VALUE 
EAST CH 10 
EAST AB 20 
EAST C  LO 30 
EAST MN 10 
EAST PQ 40 
EAST GH 50 
EAST FL 100 
EAST KP 50 
EAST IO 80 
EAST MN 60 
EAST ZX 70 
EAST HM 90 
EAST RO 45 
WEST PE 62 
WEST SC 34 
WEST EM 20 
WEST CH 40 
WEST UV 67 
WEST IR 73 
WEST TU RE 50 
WEST DE 74 
CENTRAL BC 88 
CENTRAL HG 92 
CENTRAL IQ 106 
CENTRAL AB 110 
CENTRAL PK 23 
CENTRAL ST 54 
SOUTH YS 18 
SOUTH JS 60 
SOUTH SE 30 
SOUTH PO 40 
SOUTH CE 20 
SOUTH HI 10 
SOUTH LI 200 
SOUTH BM 50 
SOUTH GM 150 
SOUTH HM 20 
SOUTH TY 30 
SOUTH UT 50 

Need below output,Top 3 category based on value in each segment as follows,

ppatil_0-1651230679891.png

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below measure and the attached pbix file.

It is for creating a new measure.

 

Value top three: = 
VAR currentsegment =
    MAX ( Segment[SEGMENT] )
VAR newtable =
    FILTER ( ALL ( Data ), Data[SEGMENT] = currentsegment )
RETURN
    CALCULATE (
        SUM ( Data[VALUE] ),
        KEEPFILTERS ( TOPN ( 3, newtable, CALCULATE ( SUM ( Data[VALUE] ) ), DESC ) )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below measure and the attached pbix file.

It is for creating a new measure.

 

Value top three: = 
VAR currentsegment =
    MAX ( Segment[SEGMENT] )
VAR newtable =
    FILTER ( ALL ( Data ), Data[SEGMENT] = currentsegment )
RETURN
    CALCULATE (
        SUM ( Data[VALUE] ),
        KEEPFILTERS ( TOPN ( 3, newtable, CALCULATE ( SUM ( Data[VALUE] ) ), DESC ) )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank U so much @Jihwan_Kim 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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