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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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]
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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]
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.