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
shripad
Frequent Visitor

Calculation of baseline and issuemix values in powerbi

Hi All 

 

I am new to Power BI and stuck in a problem. There is a sample data below. 

 

 

        
response_yearresponse_weekresponse_monthresponse_channelmarketplace_typeorder_journey_nodecount_Bcount_A
2022215SurveyLocal_shopKarnataka468
2022215SurveyLocal_shopKarnataka91
2022215SurveyLocal_shopKarnataka10
2022215SurveyLocal_shopKarnataka114
2022215SurveyLocal_shopOdisha10
2022215SurveyLocal_shopOdisha10
2022215SurveyLocal_shopChattisgarh10
2022215SurveyLocal_shopChattisgarh10
2022215SurveyLocal_shopChattisgarh10
2022215SurveyLocal_shopPunjab122
2022215SurveyLocal_shopPunjab10
2022215SurveyLocal_shopMaharashtra20
2022215SurveyLocal_shopMaharashtra123
2022215SurveyLocal_shopMaharashtra11
2022215SurveyLocal_shopMaharashtra10
2022215SurveyLocal_shopUP218
2022215SurveyLocal_shopUP40
2022215SurveyLocal_shopUP31
2022215SurveyLocal_shopUP10
2022215SurveyLocal_shopAssam415

 

 

i need the output like this 

 

 

 Sum of count_BSum of RR   
Row Labels20212021deltabaseline issuemix
Assam5.09%6.64%85.00%14.00%-71.00%-3.6132315521628500%0.22%
Chattisgarh0.51%0.40%100.00%0.00%-100.00%-0.5089058524173030%0.00%
Gujrat63.10%60.96%83.47%31.37%-52.10%-32.8743202115452000%-0.67%
Karnataka3.05%21.78%66.67%54.27%-12.40%-0.3785763048470180%10.16%
Kerela2.04%0.80%75.00%16.67%-58.33%-1.1874469889737100%-0.21%
Maharashtra4.58%2.12%77.78%25.00%-52.78%-2.4173027989821900%-0.61%
Odisha5.34%0.27%76.19%0.00%-76.19%-4.0712468193384200%0.00%
Punjab0.51%1.73%50.00%15.38%-34.62%-0.1761597181444510%0.19%
Rajasthan3.31%1.46%46.15%9.09%-37.06%-1.2260004626416800%-0.17%
UP12.47%3.85%61.22%31.03%-30.19%-3.7641484601210800%-2.67%
Grand Total100.00%100.00%78.12%34.13%-43.99%-50.22%6.23%

 

Sum of count_B has % of column total 

Sum of RR = count_b / count_A 

 

 

i wanted to know how to calculate baseline and issuemix formula in power bi from the sample data .

 

the baseline formula is :  (Sum of RR[21] - Sum of RR[20]) * Sum of count_B[20]

the issuemix formula is: : (Sum of count_B[21] - Sum of count_B[20]) * Sum of RR[21]

 

 

i got this output in excel but the values in my dax it's showing error. Unable to find the logic of these 2 formula. Please help

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @shripad,

You can take a look at the following formulas if help:

sum of countB =
CALCULATE (
    DIVIDE (
        CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
        SUM ( Table[count_B] )
    ),
    ALLSELECTED ( Table ),
    VALUES ( Table[response_year] ),
    VALUES ( Table[response_week] )
)

sum of countPR =
CALCULATE (
    DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
    ALLSELECTED ( Table ),
    VALUES ( Table[response_year] ),
    VALUES ( Table[response_week] ),
    VALUES ( Table[order_journey_node] )
)

Baseline =
VAR currWeek =
    MAX ( Table[response_week] )
RETURN
    CALCULATE (
        CALCULATE (
            DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
            Table[response_week] = currWeek
        ),
        CALCULATE (
            DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
            Table[response_week] = currWeek - 1
        ),
        ALLSELECTED ( Table ),
        VALUES ( Table[response_year] ),
        VALUES ( Table[order_journey_node] )
    )
        * CALCULATE (
            DIVIDE (
                CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
                SUM ( Table[count_B] )
            ),
            FILTER ( ALLSELECTED ( Table ), Table[response_week] = currWeek - 1 ),
            VALUES ( Table[response_year] )
        )

issuemix =
VAR currWeek =
    MAX ( Table[response_week] )
RETURN
    CALCULATE (
        CALCULATE (
            DIVIDE (
                CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
                SUM ( Table[count_B] )
            ),
            Table[response_week] = currWeek
        )
            - CALCULATE (
                DIVIDE (
                    CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
                    SUM ( Table[count_B] )
                ),
                Table[response_week] = currWeek - 1
            ),
        ALLSELECTED ( Table ),
        VALUES ( Table[response_year] )
    )
        * CALCULATE (
            CALCULATE (
                DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
                Table[response_week] = currWeek
            ),
            ALLSELECTED ( Table ),
            VALUES ( Table[response_year] ),
            VALUES ( Table[order_journey_node] )
        )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @shripad,

You can take a look at the following formulas if help:

sum of countB =
CALCULATE (
    DIVIDE (
        CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
        SUM ( Table[count_B] )
    ),
    ALLSELECTED ( Table ),
    VALUES ( Table[response_year] ),
    VALUES ( Table[response_week] )
)

sum of countPR =
CALCULATE (
    DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
    ALLSELECTED ( Table ),
    VALUES ( Table[response_year] ),
    VALUES ( Table[response_week] ),
    VALUES ( Table[order_journey_node] )
)

Baseline =
VAR currWeek =
    MAX ( Table[response_week] )
RETURN
    CALCULATE (
        CALCULATE (
            DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
            Table[response_week] = currWeek
        ),
        CALCULATE (
            DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
            Table[response_week] = currWeek - 1
        ),
        ALLSELECTED ( Table ),
        VALUES ( Table[response_year] ),
        VALUES ( Table[order_journey_node] )
    )
        * CALCULATE (
            DIVIDE (
                CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
                SUM ( Table[count_B] )
            ),
            FILTER ( ALLSELECTED ( Table ), Table[response_week] = currWeek - 1 ),
            VALUES ( Table[response_year] )
        )

issuemix =
VAR currWeek =
    MAX ( Table[response_week] )
RETURN
    CALCULATE (
        CALCULATE (
            DIVIDE (
                CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
                SUM ( Table[count_B] )
            ),
            Table[response_week] = currWeek
        )
            - CALCULATE (
                DIVIDE (
                    CALCULATE ( SUM ( Table[count_B] ), VALUES ( Table[order_journey_node] ) ),
                    SUM ( Table[count_B] )
                ),
                Table[response_week] = currWeek - 1
            ),
        ALLSELECTED ( Table ),
        VALUES ( Table[response_year] )
    )
        * CALCULATE (
            CALCULATE (
                DIVIDE ( SUM ( Table[count_B] ), SUM ( Table[count_A] ) ),
                Table[response_week] = currWeek
            ),
            ALLSELECTED ( Table ),
            VALUES ( Table[response_year] ),
            VALUES ( Table[order_journey_node] )
        )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin Sheng

 

Thank you for providing the solution. thw solution works

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.