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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Need help!!! Need to create a calculated column/measure based on top80/Bottom 20 percentage.

Hi All,

 

Need help!!! Need to create a calculated column/measure to segment based on top80/Bottom 20 percentage.

 

Below the desired output with dataset.

 

Table name'Raw data - Template'

Dataset Column : Month, Supplier Code, Total

Output Column : Cummulative % by Month , T80/ B20

 

Help to create Cummulative % by month based on the Month column.

 

 

MonthSupplier CodeTotalCummulative % by MonthT 80/ B 20
Jan-191234567 - Supplier  - 10.10406800117%T 80
Jan-191234567 - Supplier  - 160.0826015830%T 80
Jan-191234567 - Supplier  130.08066642%T 80
Jan-191234567 - Supplier  - 170.08066655%T 80
Jan-191234567 - Supplier  - 150.0669637166%T 80
Jan-191234567 - Supplier  80.058284475%T 80
Jan-191234567 - Supplier  - 120.0366118181%B 20
Jan-191234567 - Supplier  - 30.0250885%B 20
Jan-191234567 - Supplier  60.016865888%B 20
Jan-191234567 - Supplier  70.0085026989%B 20
Jan-191234567 - Supplier  190.00765676590%B 20
Jan-191234567 - Supplier  40.0075760691%B 20
Jan-191234567 - Supplier  110.0075359493%B 20
Jan-191234567 - Supplier  200.00700596494%B 20
Jan-191234567 - Supplier  - 180.0065739395%B 20
Jan-191234567 - Supplier  160.0045055895%B 20
Jan-191234567 - Supplier  - 200.0028839796%B 20
Jan-191234567 - Supplier  - 20.0027764896%B 20
Jan-191234567 - Supplier  170.0026576697%B 20
Jan-191234567 - Supplier  - 40.0026243297%B 20
Jan-191234567 - Supplier  30.0025305698%B 20
Jan-191234567 - Supplier  - 140.0021995598%B 20
Jan-191234567 - Supplier  - 100.0017655298%B 20
Jan-191234567 - Supplier  120.0014664998%B 20
Jan-191234567 - Supplier  1 0.00102499%B 20
Jan-191234567 - Supplier  - 210.0009965399%B 20
Jan-191234567 - Supplier  - 80.0009344299%B 20
Jan-191234567 - Supplier  - 60.0009012899%B 20
Jan-191234567 - Supplier  - 110.0008689699%B 20
Jan-191234567 - Supplier  - 50.0008080599%B 20
Jan-191234567 - Supplier  90.000786899%B 20
Jan-191234567 - Supplier  100.0007267599%B 20
Jan-191234567 - Supplier  140.00068507100%B 20
Jan-191234567 - Supplier  50.00063547100%B 20
Jan-191234567 - Supplier  150.00063452100%B 20
Jan-191234567 - Supplier  - 90.00050208100%B 20
Jan-191234567 - Supplier  - 190.00041469100%B 20
Jan-191234567 - Supplier  - 130.00012205100%B 20
Jan-191234567 - Supplier  - 70.00007048100%B 20
Jan-191234567 - Supplier  210.0000579100%B 20
Jan-191234567 - Supplier  184.75942E-05100%B 20
Jan-191234567 - Supplier  20.000036100%B 20
Feb-191234567 - Supplier - 130.4222240223%T 80
Feb-191234567 - Supplier - 120.4067812745%T 80
Feb-191234567 - Supplier -180.2649190760%T 80
Feb-191234567 - Supplier -80.1763851469%T 80
Feb-191234567 - Supplier - 150.1453177%T 80
Feb-191234567 - Supplier -1 0.0926631882%B 20
Feb-191234567 - Supplier -220.08287%B 20
Feb-191234567 - Supplier - 10.051805390%B 20
Feb-191234567  - Supplier -1 0.018925291%B 20
Feb-191234567 - Supplier -  50.0156800792%B 20
Feb-191234567 - Supplier -270.0149341492%B 20
Feb-191234567 - Supplier -200.0137158493%B 20
Feb-191234567 - Supplier -210.012284394%B 20
Feb-191234567 - Supplier -60.011073294%B 20
Feb-191234567 - Supplier -330.01038208695%B 20
Feb-191234567 - Supplier - 160.0087998795%B 20
Feb-191234567 - Supplier -300.0073913696%B 20
Feb-191234567 - Supplier -320.0067887196%B 20
Feb-191234567 - Supplier -100.0062317597%B 20
Feb-191234567 - Supplier - 30.0061199697%B 20
Feb-191234567 - Supplier -20.0058361597%B 20
Feb-191234567 - Supplier - 140.0057673697%B 20
Feb-191234567 - Supplier -90.00598%B 20
Feb-191234567 - Supplier -290.0046104598%B 20
Feb-191234567 - Supplier -280.004499598%B 20
Feb-191234567 - Supplier -  40.0044468798%B 20
Feb-191234567 - Supplier -120.0041514399%B 20
Feb-191234567 - Supplier -  70.0038099399%B 20
Feb-191234567 - Supplier -170.0034339199%B 20
Feb-191234567 - Supplier -190.0028432599%B 20
Feb-191234567 - Supplier -230.0026240999%B 20
Feb-191234567 - Supplier -140.0016091999%B 20
Feb-191234567 - Supplier - 80.00155175100%B 20
Feb-191234567 - Supplier -160.001249100%B 20
Feb-191234567 - Supplier -  110.00100376100%B 20
Feb-191234567 - Supplier -30.00092265100%B 20
Feb-191234567 - Supplier -250.0008568100%B 20
Feb-191234567 - Supplier -260.00082604100%B 20
Feb-191234567 - Supplier -50.000585100%B 20
Feb-191234567 - Supplier - 90.00044601100%B 20
Feb-191234567 - Supplier -150.00042516100%B 20
Feb-191234567 - Supplier -110.00034739100%B 20
Feb-191234567 - Supplier - 100.00033625100%B 20
Feb-191234567 - Supplier - 20.00025908100%B 20
Feb-191234567 - Supplier -130.00021622100%B 20
Feb-191234567 - Supplier -40.00019592100%B 20
Feb-191234567 - Supplier -310.00006751100%B 20
Feb-191234567 - Supplier -240.00006153100%B 20
Feb-191234567 - Supplier -70.00000474100%B 20

 

Any solution is very helpful.

 

Thanks !!

1 ACCEPTED SOLUTION
CheenuSing
Community Champion
Community Champion

Hi @Anonymous ,

 

Try the following steps.

 

1.  Using Edit Query Add an Index Column from 1

2.  Create calculated column

       MonthsTotal =
                SUMX ( FILTER ( Data, EARLIER ( Data[Month] ) = Data[Month] ), Data[Total] )
   This calculates the total by month

3. Create Calculated Column

      Month% = Divide(Data[Total], [MonhtsTotal])

     This calculates the % by row of each record in a month.

4. Create the calculated column

    MonthsCum%  =
   1
    - SUMX (
        FILTER (
            ALL ( Data ),
            ( Data[Month] ) = EARLIER ( Data[Month] )
                && ( Data[Index] ) > EARLIER ( Data[Index] )
        ),
        Data[Month%]
    )

   This calculates the Cumulative % by records in each month. Notice that you have to substract from 1 to adjust **bleep** by rows in a month.

 

5. Finally create calculated column

 

T80B20 = If( [MonthsCum%_Col] <=.80, "T80","B20")
 
Replace Data by your table name and field names as per your table.
 
Cheers
CheenuSing

 

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

1 REPLY 1
CheenuSing
Community Champion
Community Champion

Hi @Anonymous ,

 

Try the following steps.

 

1.  Using Edit Query Add an Index Column from 1

2.  Create calculated column

       MonthsTotal =
                SUMX ( FILTER ( Data, EARLIER ( Data[Month] ) = Data[Month] ), Data[Total] )
   This calculates the total by month

3. Create Calculated Column

      Month% = Divide(Data[Total], [MonhtsTotal])

     This calculates the % by row of each record in a month.

4. Create the calculated column

    MonthsCum%  =
   1
    - SUMX (
        FILTER (
            ALL ( Data ),
            ( Data[Month] ) = EARLIER ( Data[Month] )
                && ( Data[Index] ) > EARLIER ( Data[Index] )
        ),
        Data[Month%]
    )

   This calculates the Cumulative % by records in each month. Notice that you have to substract from 1 to adjust **bleep** by rows in a month.

 

5. Finally create calculated column

 

T80B20 = If( [MonthsCum%_Col] <=.80, "T80","B20")
 
Replace Data by your table name and field names as per your table.
 
Cheers
CheenuSing

 

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

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.