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

Total sum calculate incorect

Hi everyone,
Please help me to find solution how to fix my measure.
I have a table and in earch row is calculating measure named "Income", in row in calculate corektly, byt in sum and in cart it calculate incorect. I khow that because of context, but how to write a correct folmula?
My measure is 

 

Income = 
VAR rozr = 
 IF(
        SUM('Registr VAT'[SUM])=0 && SUM(RW[SUM])=0,
        BLANK(),
        (
        SUM(FS[SUM])- SUM('Registr VAT'[SUM])-SUM(RW[SUM])
        )
 )

RETURN rozr





andrieskoo_0-1657553524351.png

andrieskoo_2-1657553831228.png



Link to .pbix https://we.tl/t-bPXOmpkpnu 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @andrieskoo 
Please refer to the sample file with the solution https://we.tl/t-S1IzTm6gBN

1.png

Income = 
SUMX (
    SUMMARIZE ( Contracts, Contracts[ID], Contracts[SIGN_DATE], Contracts[STATUS] ),
    VAR VATSUM = CALCULATE ( SUM ( 'Registr VAT'[SUM] ) )
    VAR RWSUM = CALCULATE ( SUM ( RW[SUM] ) )
    VAR FSSUM = CALCULATE ( SUM ( FS[SUM] ) )
    RETURN
        IF ( 
            VATSUM <> 0 || RWSUM <> 0,
            FSSUM - VATSUM - RWSUM
        )
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @andrieskoo 
Please refer to the sample file with the solution https://we.tl/t-S1IzTm6gBN

1.png

Income = 
SUMX (
    SUMMARIZE ( Contracts, Contracts[ID], Contracts[SIGN_DATE], Contracts[STATUS] ),
    VAR VATSUM = CALCULATE ( SUM ( 'Registr VAT'[SUM] ) )
    VAR RWSUM = CALCULATE ( SUM ( RW[SUM] ) )
    VAR FSSUM = CALCULATE ( SUM ( FS[SUM] ) )
    RETURN
        IF ( 
            VATSUM <> 0 || RWSUM <> 0,
            FSSUM - VATSUM - RWSUM
        )
)

Thanks a lot!

amitchandak
Super User
Super User

@andrieskoo , Try like

 

Income =
VAR rozr =
Sumx(values(Table[ID]),
IF(
SUM('Registr VAT'[SUM])=0 && SUM(RW[SUM])=0,
BLANK(),
(
SUM(FS[SUM])- SUM('Registr VAT'[SUM])-SUM(RW[SUM])
)
)
)
RETURN rozr

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

Thax, for Your help, but it doesn't workr as I expect 

andrieskoo_0-1657608415402.png

 

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.