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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Analitika
Post Prodigy
Post Prodigy

sumx wrong Sum

 

2020-07-20_083440.png

PBI 

 

 

m_SSA_3 = 
VAR valText1 = "1"
VAR valText12 = "f"
VAR Result =
  CALCULATE (  CALCULATE (
        CALCULATE (
            SUM ( Table1[OPE_SUMOL] ),
            FILTER (
                Table1,
                Table1[OP_ATS] IN { 0 }
                    && NOT Table1[OP_VIE] = 3
                    && NOT Table1[ZU0_KOD] IN { valText1, valText12 }
            )
        ),
        FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
    )
        - CALCULATE (
            CALCULATE (
                SUM ( Table1[OPE_SUMOL] ),
                FILTER (
                    Table1,
                    Table1[OP_ATS] IN { 0 }
                        && Table1[OP_VIE] = 3
                        && NOT Table1[ZU0_KOD] IN { valText1, valText12 }
                )
            ),
            FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
        )
        - CALCULATE (
            CALCULATE (
                SUM ( Table1[OPE_SUMOL] ),
                FILTER (
                    Table1,
                    Table1[OP_ATS] IN { 2 }
                        && NOT Table1[ZU0_KOD] IN { valText1, valText12 }
                )
            ),
            FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
        )
        - CALCULATE (
            CALCULATE (
                SUM ( Table1[OPE_SUMOL] ),
                FILTER (
                    Table1,
                    Table1[OP_ATS] IN { 0 }
                        && Table1[ZU0_KOD] IN { valText1, valText12 }
                        && Table1[_MZA2] > 0
                )
            ),
            FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
        )
        - CALCULATE (
            CALCULATE (
                SUM ( Table1[OPE_SUMOL] ),
                FILTER (
                    Table1,
                    Table1[OP_ATS] IN { 0 }
                        && Table1[ZU0_KOD] IN { valText1, valText12 }
                        && Table1[_MZA2] < 0
                )
            ),
            FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
        ),
        FILTER(Table2,Table2[SK/AV]="IAT")
    )


RETURN

    IF (
        SELECTEDVALUE(  Table1[rus_kod] ) = "PREK_G" || SELECTEDVALUE(  Table1[rus_kod] ) = "NUOLAI", Result, -Result 
    )

 

 

Sumx sum wrong

 

 

m_SSA_3_Total = 
SUMX(
    values(Table1[_MN]),
    _Measures[m_SSA_3]
)

 

 

Why?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Analitika , Try like


m_SSA_3_Total =
SUMX(
summarize(Table1,Table1[_MN],Table1[RUS_KOD],"_1"
_Measures[m_SSA_3]), [_1]
)

or
m_SSA_3_Total =
SUMX(
summarize(Table1,Table1[_MN],Table1[RUS_KOD],Table1[did_date],"_1"
_Measures[m_SSA_3]), [_1]
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Analitika , Try like


m_SSA_3_Total =
SUMX(
summarize(Table1,Table1[_MN],Table1[RUS_KOD],"_1"
_Measures[m_SSA_3]), [_1]
)

or
m_SSA_3_Total =
SUMX(
summarize(Table1,Table1[_MN],Table1[RUS_KOD],Table1[did_date],"_1"
_Measures[m_SSA_3]), [_1]
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 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.