Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Two different dates slicing single visualisation

Hi , I have a table as shown in the screenshot .  Then it should compare the sum of the amount for each purchase element for each date that we select in the slicer. Let the two compare measures be...
  • v-juanli-msft's avatar
    7 years ago

    Hi Anonymous 

    I can create two measure to show values of comparing 1 and comparing 2.

    First, create two tables

    filte1 = CROSSJOIN(VALUES('Table'[type]),VALUES('Table'[date]))
    
    filter2 = CROSSJOIN(VALUES('Table'[type]),VALUES('Table'[date]))

    They have no relationship with others.

     

    Then add "date" and "type" from two tables in slicers.

     

    Create measures

    compare1 = CALCULATE(SUM('Table'[amount]),FILTER(ALLEXCEPT('Table','Table'[item]),'Table'[type]=SELECTEDVALUE('filte1'[type])&&'Table'[date]=SELECTEDVALUE(filte1[date])))
    
    compare2 = CALCULATE(SUM('Table'[amount]),FILTER(ALLEXCEPT('Table','Table'[item]),'Table'[type]=SELECTEDVALUE('filter2'[type])&&'Table'[date]=SELECTEDVALUE(filter2[date])))

    Best Regards
    Maggie

     

    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.