Forum Discussion

977roshan's avatar
977roshan
New Member
7 years ago
Solved

DATEADD / PARALLELPERIOD RETURNING SAME VALUE

Hi,

 

I'm trying to get a simple KPI that have current month Total Sales and Last month Total Sales. I already have the following measures for Total Sales.

 

Total Sales:=SUMX(sales,sales[Qty]*sales[SellingPrice])

 

For last month:

 

Last Month Sales:=CALCULATE([Total Sales],DATEADD(DimDate[Date],-1,MONTH))

 

Both the Dates in SalesOrder Table and Date Table have 'short date' format. I also connecting Fact table and Date table with DateKey (surrogate key) but either way, I'm getting the exact same value of last month instead of a month before. I was wondering if I'm missing something? It's not working either is Tabular Cube or Power BI Desktop. I will appreciate any help I could get. Thanks!

  • 977roshan ,

     

    You can modify you measure like pattern below and check if it can meet your requirement:

    Last Month Sales :=
    CALCULATE (
        [Total Sales],
        FILTER ( DimDate, Dimdate[Date] = MONTH ( TODAY () ) - 1 )
    )
    

    Community Support Team _ Jimmy Tao

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

1 Reply

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    977roshan ,

     

    You can modify you measure like pattern below and check if it can meet your requirement:

    Last Month Sales :=
    CALCULATE (
        [Total Sales],
        FILTER ( DimDate, Dimdate[Date] = MONTH ( TODAY () ) - 1 )
    )
    

    Community Support Team _ Jimmy Tao

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