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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rajasekar_o
Helper III
Helper III

Top 3 Calculate

I  have data of target and sales 
1.I want to calculate ASM wise  sales the condition is  (top 3 flg =y and  which target value is top 3 that related sales value want to calculate )
2.BM wise  sales the condition is  (top 3 flg =y and  top 3 target[which target value is top 3 that related sales value want to calculate )

dealer codeASO codeASM codeBM codetargetsalestop 3flg
DEALE-01ASO-01ASM-01BM-011000985Y
DEALE-02ASO-01ASM-01BM-013245868 
DEALE-03ASO-01ASM-01BM-0124548686Y
DEALE-04ASO-01ASM-01BM-0153758668 
DEALE-05ASO-01ASM-01BM-0184536546Y
DEALE-06ASO-02ASM-01BM-0153536464 
DEALE-07ASO-02ASM-01BM-0154365364Y
DEALE-08ASO-02ASM-01BM-0143245363Y
DEALE-09ASO-02ASM-01BM-0195746464 
DEALE-10ASO-02ASM-01BM-0195758437Y
DEALE-11ASO-03ASM-01BM-0185644443Y
DEALE-12ASO-03ASM-01BM-0175935356Y
DEALE-13ASO-03ASM-01BM-0163457567 
DEALE-14ASO-03ASM-01BM-0143454535Y
DEALE-15ASO-03ASM-01BM-0134257654Y
DEALE-16ASO-04ASM-01BM-0136452345 
DEALE-17ASO-04ASM-01BM-0186753437Y
DEALE-18ASO-04ASM-01BM-0153424645 
DEALE-19ASO-04ASM-01BM-0135453678Y
DEALE-20ASO-04ASM-01BM-0142434267Y
DEALE-21ASO-05ASM-01BM-0174388453 
DEALE-22ASO-05ASM-01BM-0198575353y
DEALE-23ASO-05ASM-02BM-0195755436 
DEALE-24ASO-05ASM-02BM-0195854324y
DEALE-25ASO-05ASM-02BM-0194749574 
DEALE-26ASO-06ASM-02BM-0198769575 
DEALE-27ASO-06ASM-02BM-0179768564y
DEALE-28ASO-06ASM-02BM-0186987593 
DEALE-29ASO-06ASM-02BM-0179696345y
DEALE-30ASO-06ASM-02BM-0197974345 
DEALE-31ASO-07ASM-02BM-0175478453 
DEALE-32ASO-07ASM-02BM-0197595353y
DEALE-33ASO-07ASM-02BM-0186865436 
DEALE-34ASO-07ASM-02BM-0150004324y
DEALE-35ASO-07ASM-02BM-0175959574 
DEALE-36ASO-08ASM-02BM-0159599575y
DEALE-37ASO-08ASM-02BM-0198538564y
DEALE-38ASO-08ASM-02BM-0153987593y
DEALE-39ASO-08ASM-02BM-0185596345 
DEALE-40ASO-08ASM-02BM-0198534345y



5 REPLIES 5
ryan_mayu
Super User
Super User

the top 3 flg column already exists in your data?

could you pls provide some details on how to get the output from the sample data?

e.g. how to get 9876? how to get 9861?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




rajasekar_o
Helper III
Helper III

@amitchandak 
i want Sum(sales) related to the top 3 target value 

rajasekar_o_0-1713876024904.png

the expected out put is bm top 3= 26201

amitchandak
Super User
Super User

@rajasekar_o , You can create a measure like

 

M1=  calculate(Sum(Table[sales]), filter(Table, Table[top 3flg] ="y"))

 

or, in case you want to use other group by in visual

 

M1=  calculate(Sum(Table[sales]), filter(Table, Table[top 3flg] ="y"), allexcept(Table,Table[ASM  Code] )

 

then create TOPN measure

 

Top 3 = Calculate( [M1], keepfilter(TOPN(3,allselected([Table[ASM Code]), [M1], asc) ))

 

You can also code the window function

 

TOPN: https://youtu.be/QIVEFp-QiOk
TOPN with Numeric Parameter -https://youtu.be/cN8AO3_vmlY?t=26448

 

Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ


@amitchandak 
I  Want to  calculate
1.ASO top 2 sales based on  top2 target value  the top 2 target is take only if t20 is 'Y'
2.ASM top 2 sales based on  top2 target value  the top 2 target is take only if t20 is 'Y'
3.BM top 2 sales based on  top2 target value  the top 2 target is take only if t20 is 'Y'

DEALERCODEASO CODEASM CODEBM CODEsalesTARGETt20
DEALE-01ASO-01ASM-01BM-013898839000Y
DEALE-02ASO-01ASM-01BM-0134883500Y
DEALE-03ASO-01ASM-01BM-0144884500 
DEALE-04ASO-01ASM-01BM-0175887600Y
DEALE-05ASO-01ASM-01BM-0134883500 
DEALE-06ASO-02ASM-01BM-011208812100 
DEALE-07ASO-02ASM-01BM-011108811100Y
DEALE-08ASO-02ASM-01BM-011558815600Y
DEALE-09ASO-02ASM-01BM-012318823200Y
DEALE-10ASO-02ASM-01BM-012668826700 
DEALE-11ASO-03ASM-02BM-013878838800Y
DEALE-12ASO-03ASM-02BM-014988849900Y
DEALE-13ASO-03ASM-02BM-011208812100Y
DEALE-14ASO-03ASM-02BM-011254812560 
DEALE-15ASO-03ASM-02BM-011638816400 
DEALE-16ASO-04ASM-02BM-011830818320 
DEALE-17ASO-04ASM-02BM-012143821450 
DEALE-18ASO-04ASM-02BM-013118831200Y
DEALE-19ASO-04ASM-02BM-014498845000Y
DEALE-20ASO-04ASM-02BM-0164886500Y

 


THE FINAL OUT PUT 
ASO TOP 2 SALES =261304
ASM TOP 2 SALES=157052
BM TOP 2 SALES =81076

rajasekar_o_0-1714477789287.png

i try calculation for ASO TOP 2 SALES ,ASM TOP 2 SALES,BM TOP 2 SALES  its show same value for all.
how to calculate this 

 

@amitchandak 
i want  sales amount of top 3 target 
as ur given measure didn take a target
ur calculating top3 sales value only  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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