Forum Discussion

anacpint's avatar
anacpint
Helper I
4 years ago
Solved

Total value coming from measure is wrong

Hello,

 

I developed this measure:

CALCULATE(if([COUNTReport]=2, DIVIDE(SUM(FactOTDJnJPap[measurevalue]),2), SUM(FactOTDJnJPap[measurevalue])), FactOTDJnJPap[IDTypeReportJnJPharma] IN {1,5})

The row values are correct but the total is wrong, the value should be around 9,2.

In the next image I explain better what I have now coming from the Fact and what I need to calculate.

I have a line chart with the values for every Site (this one is showing the correct values) and another one with the total value divided by the number of sites (it's not always the same number) for that month.

 

Really appreciate your help, I'm stucked with this for 2 days.

 

Thanks is advance.

  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi anacpint 
    Pleas try 

    OTD_TESTE =
    SUMX (
        SUMMARIZE ( FactOTDJnJPap, DimSite[jnj_site], DimTypeReport[type_of_report] ),
        CALCULATE (
            IF (
                [COUNTReport] = 2,
                DIVIDE ( SUM ( FactOTDJnJPap[measurevalue] ), 2 ),
                SUM ( FactOTDJnJPap[measurevalue] )
            ),
            FactOTDJnJPap[IDTypeReportJnJPharma] IN { 1, 5 }
        )
    )

6 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi anacpint 

    please try

    OTD_TESTE =
    SUMX (
        VALUES ( FactOTDJnJPap[jnj_site] ),
        CALCULATE (
            IF (
                [COUNTReport] = 2,
                DIVIDE ( SUM ( FactOTDJnJPap[measurevalue] ), 2 ),
                SUM ( FactOTDJnJPap[measurevalue] )
            ),
            FactOTDJnJPap[IDTypeReportJnJPharma] IN { 1, 5 }
        )
    )
    • anacpint's avatar
      anacpint
      Helper I

      Hi, Thank you for your answer!

      Didn't work, the values still the same...

      • tamerj1's avatar
        tamerj1
        Community Champion

        anacpint 
        It is critical that you provide complete and accurate information. This solution is based on the screenshot of the table visual that you've provided. In case you have other columns/tables invloved in this table either directly or indirectly (via slicers, visual filters or page filters) please let me know.