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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Binway
Helper II
Helper II

Total Incorrect

Hi All,

This code summarises the data correctly and places the values in the Previous Month as required but won't display the correct total.

CALCULATE(
SUMX (
    SUMMARIZE (
        Opportunity,
        Opportunity[Currency],
        'Probability'[Probability Lower Band Value],
        'Currency conversion'[Conversion rate NZ to AUD]
    ),
    VAR TotalAmount =
        CALCULATE ( SUM ( Opportunity[Total amount] ) )
    VAR ConversionRateFinal =
        IF ( Opportunity[Currency] = "AUS$", 1, 'Currency conversion'[Conversion rate NZ to AUD] )
    VAR ProbabilityFinal = 'Probability'[Probability Lower Band Value]/ 100
    RETURN
        TotalAmount * ProbabilityFinal
            / ConversionRateFinal
            / 1000
),PREVIOUSMONTH('Date'[Date]))

Which produces the correct result for each previous month that align to the current month as displayed in this table below but the total is not correct. I have read about HASONEVALUE but couldn't see how to apply it in this case.

 

PrevMth.PNG

Appreciate the time.

1 ACCEPTED SOLUTION
Chihiro
Solution Sage
Solution Sage

Check if your "Month-Year" column has one value, then do your current calculation.

If not do total calculation.

 

So something like...

Measure =
IF (
    HASONEVALUE ( 'Date'[Month-year] ),
    CALCULATE (
        SUMX (
            SUMMARIZE (
                Opportunity,
                Opportunity[Currency],
                'Probability'[Probability Lower Band Value],
                'Currency conversion'[Conversion rate NZ to AUD]
            ),
            VAR TotalAmount =
                CALCULATE ( SUM ( Opportunity[Total amount] ) )
            VAR ConversionRateFinal =
                IF (
                    Opportunity[Currency] = "AUS$",
                    1,
                    'Currency conversion'[Conversion rate NZ to AUD]
                )
            VAR ProbabilityFinal = 'Probability'[Probability Lower Band Value] / 100
            RETURN
                TotalAmount * ProbabilityFinal
                    / ConversionRateFinal
                    / 1000
        ),
        PREVIOUSMONTH ( 'Date'[Date] )
    ),
    "Your total calculation"
)

Replace "Your total calculation" with actual measure/DAX formula.

View solution in original post

1 REPLY 1
Chihiro
Solution Sage
Solution Sage

Check if your "Month-Year" column has one value, then do your current calculation.

If not do total calculation.

 

So something like...

Measure =
IF (
    HASONEVALUE ( 'Date'[Month-year] ),
    CALCULATE (
        SUMX (
            SUMMARIZE (
                Opportunity,
                Opportunity[Currency],
                'Probability'[Probability Lower Band Value],
                'Currency conversion'[Conversion rate NZ to AUD]
            ),
            VAR TotalAmount =
                CALCULATE ( SUM ( Opportunity[Total amount] ) )
            VAR ConversionRateFinal =
                IF (
                    Opportunity[Currency] = "AUS$",
                    1,
                    'Currency conversion'[Conversion rate NZ to AUD]
                )
            VAR ProbabilityFinal = 'Probability'[Probability Lower Band Value] / 100
            RETURN
                TotalAmount * ProbabilityFinal
                    / ConversionRateFinal
                    / 1000
        ),
        PREVIOUSMONTH ( 'Date'[Date] )
    ),
    "Your total calculation"
)

Replace "Your total calculation" with actual measure/DAX formula.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.