Forum Discussion

Pbiuserr's avatar
Pbiuserr
Post Prodigy
3 years ago

Incorrect total

Hello,

As the title says - my total is incorrect - should be grouped to 6.22

Measure I've used

Value Measure thousands = 
CALCULATE ( VAR __INVOICED = CALCULATE( SUM(fact_table'[AMOUNT]), FILTER( 'cost_table', 'cost_table'[TYPE] = "INVOICED" ) ) RETURN DIVIDE ( __INVOICED, 1000 ) )

 

 

Tried with ALL, ALLEXCEPT, nothing works

4 Replies

  • Pbiuserr , Try Like

     

    Value Measure thousands =
    VAR __INVOICED = CALCULATE(
    SUM('fact_table'[AMOUNT]),
    FILTER(
    'cost_table',
    'cost_table'[TYPE] = "INVOICED" )
    )
    RETURN
    sumx(Values('cost_table'[Item]), calculate(DIVIDE ( __INVOICED, 1000 ) ))

    • Pbiuserr's avatar
      Pbiuserr
      Post Prodigy

      Hi,

      Item is actually from "Items" table, nevertheless it is not changing the totals, unfortuantely

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Pbiuserr ,

         

        Try completing the field/filter in code. like:

        Value Measure thousands =
        VAR __INVOICED =
            CALCULATE (
                SUM ( 'fact_table'[AMOUNT] ),
                FILTER ( 'cost_table', 'cost_table'[TYPE] = "INVOICED" )
            )
        RETURN
            SUMX (
                SUMMARIZE (
                    'Items',
                    'Items'[Item],
                    'TableName'[Label],
                    'TableName'[Type],
                    'TableName'[Year],
                    'TableName'[Month],
                    "rate", CALCULATE ( DIVIDE ( __INVOICED, 1000 ) )
                ),
                [rate]
            )

        Best Regards,
        Gao

        Community Support Team

         

        If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

        How to get your questions answered quickly --  How to provide sample data in the Power BI Forum