Forum Discussion

pedroccamaraDBI's avatar
pedroccamaraDBI
Icon for Post Partisan rankPost Partisan
4 years ago
Solved

Total Sales from 2 different dates

Hello all. I hope everyone's ok. I believe i got a challenge for you all. I need to see the Sales for 2 distinct periodes I have this visual that shows me the total sales by Product and by filtere...
  • v-xiaotang's avatar
    4 years ago

    Hi pedroccamaraDBI 

    You need to create 2 date tables, and use them to create date slicers. I create a sample file for your reference.

    Sample Data

    Step 1: create two date tables and establish an inactive relationship between them

    Calendar1 = CALENDAR(DATE(2021,1,1),DATE(2021,12,31))
    Calendar2 = CALENDAR(DATE(2021,1,1),DATE(2021,12,31))

    .

    Step2: create the measures bellow

     

     

    Sales_Period1 = SUM('Table'[Net Sales])
    Sales_Period2 =
    VAR _period2 =
        CALCULATETABLE (
            VALUES ( Calendar1[Date] ),
            REMOVEFILTERS ( Calendar1 ),
            USERELATIONSHIP ( Calendar1[Date], Calendar2[Date] )
        )
    RETURN
        CALCULATE ( [Sales_Period1], _period2 )

    .

    FYI:

    Active vs inactive relationship guidance

    USERELATIONSHIP()

    REMOVEFILTERS()

     

    Best Regards,

    Community Support Team _Tang

    If this post helps, please consider Accept it as the solution to help the other members find it more quickly.