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
mikemurray212
Regular Visitor

Distributing values across categories

Hi all - hope you can help.  I have a need to redistrubute values from some categories across the remaining categories based on the overall percentage the remaining categories have.  

 

In the example below, I want to take the total value of Category 1 and Category 2 and spread it across Categories 3-6 based on their percentage of the sum total of categories 3-6.  the table below shows the walk from initial value to what I am looking to achieve in "Final Category Sum".  Any help is appreciated.

 

CategoriesValue% of TOTAL (without Cat1 & Cat2)Cat1 & Cat2 ReallocationFinal Category Sum
Category 1100%0.00.0
Category 2200%0.00.0
Category 33017%5.035.0
Category 44022%6.746.7
Category 55028%8.358.3
Category 66033%10.070.0
TOTAL210100%30210
1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi mikemurray212,

 

To achieve your requirement, create three calculate columns using DAX below:

% of TOTAL (without Cat1 & Cat2) = 
IF (
    Table1[Categories] = "Category 1"
        || Table1[Categories] = "Category 2",
    0,
    Table1[Value]
        / CALCULATE (
            SUM ( Table1[Value] ),
            FILTER (
                Table1,
                Table1[Categories] <> "Category 1"
                    && Table1[Categories] <> "Category 2"
            )
        )
)
Cat1 & Cat2 Reallocation = 
IF (
    Table1[Categories] = "Category 1"
        || Table1[Categories] = "Category 2",
    0,
    Table1[% of TOTAL (without Cat1 & Cat2)]
        * CALCULATE (
            SUM ( Table1[Value] ),
            FILTER (
                Table1,
                Table1[Categories] = "Category 1"
                    || Table1[Categories] = "Category 2"
            )
        )
)
Final Category Sum = 
IF (
    Table1[Categories] = "Category 1"
        || Table1[Categories] = "Category 2",
    0,
    Table1[Value] + Table1[Cat1 & Cat2 Reallocation]
)

2.PNG捕获.PNG2.PNG3.PNG 

 

Regards,

Jimmy Tao

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi mikemurray212,

 

To achieve your requirement, create three calculate columns using DAX below:

% of TOTAL (without Cat1 & Cat2) = 
IF (
    Table1[Categories] = "Category 1"
        || Table1[Categories] = "Category 2",
    0,
    Table1[Value]
        / CALCULATE (
            SUM ( Table1[Value] ),
            FILTER (
                Table1,
                Table1[Categories] <> "Category 1"
                    && Table1[Categories] <> "Category 2"
            )
        )
)
Cat1 & Cat2 Reallocation = 
IF (
    Table1[Categories] = "Category 1"
        || Table1[Categories] = "Category 2",
    0,
    Table1[% of TOTAL (without Cat1 & Cat2)]
        * CALCULATE (
            SUM ( Table1[Value] ),
            FILTER (
                Table1,
                Table1[Categories] = "Category 1"
                    || Table1[Categories] = "Category 2"
            )
        )
)
Final Category Sum = 
IF (
    Table1[Categories] = "Category 1"
        || Table1[Categories] = "Category 2",
    0,
    Table1[Value] + Table1[Cat1 & Cat2 Reallocation]
)

2.PNG捕获.PNG2.PNG3.PNG 

 

Regards,

Jimmy Tao

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.