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
Analitika
Post Prodigy
Post Prodigy

Wrong totals

I have main measure which produce wrong total if m_SSA_3 measure is changed

m_SSA = 
VAR Sum1 = [m_SSA_1] - [m_SSA_2]
VAR Sum2 = [m_SSA_3] - [m_SSA_4]

RETURN
    SWITCH(TRUE(),
        "IAT" in distinct ( Table2[SK/AV] ) ,
            Sum2,
        "GIA" in distinct ( Table2[SK/AV]),
            Sum1
    )
 

 

if m_SSA_3 measure is changed from this

 

m_SSA_3 = 
VAR valText1 = "$PRD"
VAR valText12 = "$PR.L"
VAR Result =CALCULATE ( .... huge countings)

RETURN
    SWITCH(TRUE(),
        "IAT" in distinct ( Table2[SK/AV] ) ,
            -Result,
        "GIA" in distinct ( Table2[SK/AV]),
            Result
    )

Good totalGood total

to this

 

m_SSA_3 = 
VAR valText1 = "$PRD"
VAR valText12 = "$PR.L"
VAR Result =CALCULATE ( .... huge countings)
VAR discount =
    IF (
       "PR" IN DISTINCT ( Table1[rus_kod] )|| "NU" IN DISTINCT ( Table1[rus_kod] ), Result, -Result 
     )

RETURN
    SWITCH(TRUE(),
        "IAT" in distinct ( Table2[SK/AV] ) ,
            discount,
        "GIA" in distinct ( Table2[SK/AV]),
            Result
    )

Wrong total, must be -3982.03Wrong total, must be -3982.03

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Analitika , this happens when you use switch or if.  refer filter . Of have formula like

new m_SSA_3 = sumx(values(Table[_MN]),[m_SSA_3])

 

Or move switch  calculation inside sumx or countx

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Analitika , this happens when you use switch or if.  refer filter . Of have formula like

new m_SSA_3 = sumx(values(Table[_MN]),[m_SSA_3])

 

Or move switch  calculation inside sumx or countx

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.

Top Solution Authors