Forum Discussion

antonioaceituno's avatar
antonioaceituno
Frequent Visitor
8 years ago
Solved

Aggregation to avoid accounting twice

Hi,   I was wondering if any of you may help me with one sintaxis issue I have:   I have one table in my datasert: Column A: Country: Spain, Italy, England. Column B:Date (dd/mm/yyyy), Column C: ...
  • antonioaceituno's avatar
    antonioaceituno
    8 years ago

    Thank you so much for your help!

     

    It almost works, but it does not when I select different dates at the same time. Selecting more days creates conflict. 

     

    When selecting Spain & Italy days 1 & 2, the result should be

    Day 1: 50+40

    Day 2: 12+5

    Result: 90+17=107

     

    However, the "Card plot" says "MdxScript(Model) (3,70) Calculation error in measure 'Table1[Measure]: A table of multiple values was supplied where a single value was expected"

     

    Thank you so much again!

     

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    HI antonioaceituno

     

    Try this revised MEASURE

     

    Measure =
    SUMX (
        SUMMARIZE ( ALLSELECTED ( Table1 ), Table1[Country], Table1[Date] ),
        CALCULATE ( DISTINCT ( Table1[Daily Target] ) )
    )