Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

same period last year missing value

Hello, 
I have virtual table that name is main and which created with two table. 
I need calculate last year of exact date and ı used sameperiod last year . However, when ı used sameperiod last year ı have a missing value. When ı cross check with the table that is not appenden to another, 
This table1  shows for 2022, ı mean LY supposed to be 2021,

this table2 show when ı selected 2021

And here is the my basic formulla;

IF(ISBLANK(
CALCULATE([Net Sales Qty TY], SAMEPERIODLASTYEAR(Date_Dim_Table[Date]))),0,CALCULATE([Net Sales Qty TY], SAMEPERIODLASTYEAR(Date_Dim_Table[Date]))) 

Actually table 1 supposed to equal to table 2 but there is linkage that ı cannot find, my data flows correctly . are there any dax instead of sameperiod last year which can be dynamic with week & mont & and ? 
Thank you for your helping.
Have a good one
@sameper

4 Replies

  • Anonymous Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. 

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      I m so sorry but ı can not share because pbı includes company's data

  • Anonymous 

    Total Unit Price LY =
     CALCULATE([Total Unit Price],PREVIOUSYEAR('Training Dim Date'[Date]))
     
    Total LY =
    IF (
        ISBLANK (
            CALCULATE ( [Total Unit Price], PREVIOUSYEAR ( 'Training Dim Date'[Date] ) )
        ),
        0,
        CALCULATE ( [Total Unit Price], PREVIOUSYEAR ( 'Training Dim Date'[Date] ) )
    )
     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      I tired your measure but i does not work neither date nor week in my data 
      I just need a measure that can be dynamic with my week and date column  except sameperiod lastyear measure

      thank for having time with me btw