Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Parallelperiod not working as expected

Hello, 

With Covid 19 , I am trying to compare monthly "numbers" with the ones from last year but also from the same period in 2019 ...

 

My table is only 2 columns : date & number1 

I am adding a column number2 

 = CALCULATE(SUM(MyTable[number1]), PARALLELPERIOD(MyTable[Date],( ( 2019 - year(MyTable[Date]) ) * 12) ,MONTH) )
 
but il only returns data for 2019 !!! Any idea of my mistake ?
 
Tintin94230_0-1645544328771.png

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated column.

number2 =
var _current='Table'[number1]
var _last=CALCULATE(SUM('Table'[number1]),FILTER(ALL('Table'),'Table'[Date]=DATE( YEAR(EARLIER('Table'[Date]))-1,MONTH(EARLIER('Table'[Date])),DAY(EARLIER('Table'[Date])))))
return
_current-_last

2. Result:

vyangliumsft_0-1645777233755.png

If I have misunderstood your meaning, please provide your desired output and your pbix file without privacy information.

 

Best Regards,

Liu Yang

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

View solution in original post

7 REPLIES 7
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated column.

number2 =
var _current='Table'[number1]
var _last=CALCULATE(SUM('Table'[number1]),FILTER(ALL('Table'),'Table'[Date]=DATE( YEAR(EARLIER('Table'[Date]))-1,MONTH(EARLIER('Table'[Date])),DAY(EARLIER('Table'[Date])))))
return
_current-_last

2. Result:

vyangliumsft_0-1645777233755.png

If I have misunderstood your meaning, please provide your desired output and your pbix file without privacy information.

 

Best Regards,

Liu Yang

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

Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

Try to use calender date table in PARALLELPERIOD.

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Hello, you mean the calendar date that I use as "date" reference in my Power BI ? 

Calendrier =
ADDCOLUMNS(
CALENDAR(DATE(2019,01,01), TODAY()),
"Année" , year([Date]),
"Année Trimestre", Year([Date]) & "-Q" & Format([Date], "q"),
"Année Mois" , FORMAT([date],"YYYY MM"),
"Num Mois", FORMAT ( [Date], "MM" ),
"Mois", FORMAT([date],"MMMM"),
"Semaine", WEEKNUM([Date]),
"Trimestre", "Q" & FORMAT ( [Date], "Q" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" )
)
Anonymous
Not applicable

they are linked 

Tintin94230_0-1645545090976.png

same issue with 

number2   = CALCULATE(SUM(MyTable[number1]), PARALLELPERIOD('Calendrier'[Date],( ( 2019 - year(MyTable[Date]) ) * 12) ,MONTH) )

@Anonymous Yes try to use it.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

number2   = CALCULATE(SUM(MyTable[number1]), PARALLELPERIOD('Calendrier'[Date],( ( 2019 - year(MyTable[Date]) ) * 12) ,MONTH) ) is giving the same result ... only resylts for 2019 dates !!! 
 
and when I try 
number2   = CALCULATE(SUM(MyTable[number1]), PARALLELPERIOD('Calendrier'[Date],( ( 2019 - year('Calendrier'[Date]) ) * 12) ,MONTH) ) ... I have power bi error saying too many values in Calendrier ... Tintin94230_0-1645545461439.png

 

 

@Anonymous Do you want to calculate 2019 and previous year on the same column?

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.