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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Edgar_massa
Helper II
Helper II

Result Calculation Measure

Good night people

Guys is the following, I have the following look below:

 

Edgar_massa_0-1686862826090.png

 

Explaining the context, I have Planned and Accomplished Expenses and Planned and Accomplished Revenues which are information that exist in my data, however, Planned and Accomplished Result I inserted via PowerQuery to calculate in this visual as follows:

Planned Result = Planned Expenses - Planned Revenues

and I used the same logic to carry out also as measured below;

 

#Planejado, Realizado e Resultado =

    VAR _SEL = SELECTEDVALUE(dim_ContextoTipo[contextotipo])

    VAR RP =  CALCULATE(
                        [Soma Contabil, Financeiro e Gerencial],
                            dim_ContextoTipo[contextotipo] = "Receitas Planejadas"
                    )

    VAR DP =  CALCULATE(
                        [Soma Contabil, Financeiro e Gerencial],
                            dim_ContextoTipo[contextotipo] = "Despesas Planejadas"
                    )

    VAR RESULTADO_PLANEJADO = RP - DP


    VAR RR =  CALCULATE(
                        [Soma Contabil, Financeiro e Gerencial],
                            dim_ContextoTipo[contextotipo] = "Receitas Realizadas"
                    )

    VAR DR =  CALCULATE(
                        [Soma Contabil, Financeiro e Gerencial],
                            dim_ContextoTipo[contextotipo] = "Despesas Realizadas"
                    )

    VAR RESULTADO_REALIZADO = RR - DR

    VAR RESULTADO_CONSOLIDADO =
            SWITCH(
            _SEL,
            "Despesas Realizadas", [Soma Contabil, Financeiro e Gerencial],
            "Despesas Planejadas", [Soma Contabil, Financeiro e Gerencial],
            "Receitas Realizadas", [Soma Contabil, Financeiro e Gerencial],
            "Receitas Planejadas", [Soma Contabil, Financeiro e Gerencial],
            "Resultado Planejado", RESULTADO_PLANEJADO,
            "Resultado Realizado", RESULTADO_REALIZADO

        , BLANK())

    RETURN
        RESULTADO_CONSOLIDADO
 
 
Now I will explain my problem, I created a column to classify the names where the income comes before the expense, but when I do that, my result disappears, what do I do?
1 REPLY 1
Edgar_massa
Helper II
Helper II

What happens after I sort the column in the order I want!

 

Edgar_massa_0-1686863284844.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.