Forum Discussion

awolf88's avatar
awolf88
Icon for Helper II rankHelper II
4 years ago
Solved

Issue with subtotals after multiplication factor

Dearest community, Aware that this is a "common" mistake, I've tried every solution and still can't find an answer to my problem: I have a simple measure written as follows, summing the totals of a...
  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi awolf88 
    Of course your data model more complex than the sample file. It is not easy to identify the problem without deeply looking into the data. Therefore, the answer to your question is "it depends". It depends on many factors. But I may guess that the month column (Either Month Name or Year Month, whichever you are using) must be involved in table over which SUMX performs its iteration. I believe the following formula would solve the issue

    m Orders total *factor NEW 3 = 
    SUMX (
        CROSSJOIN ( VALUES ( Budget[Customer/Prod] ), VALUES ('Date'[Month Name] ) ),
        CALCULATE ( 
            CALCULATE ( 
                SUM ( Sales[Ordered Qty] ),
                TREATAS (
                    VALUES ( Budget[Customer/Prod] ), Sales[Customer/Prod]
                )
            ) * SUM ( Budget[mult. Factor] )
        )
    )