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
blytonpereira
Helper II
Helper II

Linking calendar table issues

Hi Everyone,

 

I have a dataset for example

Period      Brand    Value

2018M01  XX         2

2018M01  XY         3

2018M01  XZ         2

2018M02  XZ        4

 

I now linked the "Period" column in my dataset to my calendar table "YearMonth" column that has values similar such as 2018M01.

Since to build this relationship, only a Many (mydataset) to One (Calendar) relationship would work. Hence I removed all duplicates in my "YearMonth" column in my calendar table for the relatioship to work properly.

 

Now I would like to build a DAX measure for

Sales = SUM(Value)

Sales PriorYEar = Calculate (SALES, SAMEPERIODLASTYEAR(DATE)

 

The sales prior year equation will not work because as mentioned earlier I rmeoved duplicates in my calendar table and sales prioir year needs a full DATE range for it to work .

 

Any suggestions would be very healpful.

Thank you.

2 ACCEPTED SOLUTIONS

Hi @blytonpereira

 

you use a financial calendar.

The Power BI time intelligence works with the "normal" calendar.

So the function SAMEPERIODLASTYEAR will not compare the same financial period.

 

Wikipedia

"A disadvantage of the 4–4–5 calendar is that it has only 364 days (7 days x 52 weeks), meaning a 53rd week will need to be added every five or six years: this can make year-on-year comparison difficult."

 

Here my sample pbix file.

PBIX

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

You have to activate the preview feature in the options

Preview Feature.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

9 REPLIES 9

Hi @blytonpereira

 

write your data to the first of each month and don't change the calendar table.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegenerThanks for your reply.

 

I am not quite understanding your method as I am fairly new to POwerBI

I have shared the .pbix calendar file here

 

Good DRIVE

 

PLease try and edit the file itself if possible so I can understand more better

 

Thanks

Hi @blytonpereira

 

you use a financial calendar.

The Power BI time intelligence works with the "normal" calendar.

So the function SAMEPERIODLASTYEAR will not compare the same financial period.

 

Wikipedia

"A disadvantage of the 4–4–5 calendar is that it has only 364 days (7 days x 52 weeks), meaning a 53rd week will need to be added every five or six years: this can make year-on-year comparison difficult."

 

Here my sample pbix file.

PBIX

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegener

 

Thanks a lot. This worked perfectly. I followed your steps, creating a full financial calendar...and then creating a separate unique dates calendar for firest of each month....and then appending the unique dates to my original dataset.

 

Then I create a relationship Many (my dataset) to One (my full financial calendar). Works great.

 

I have one more problem:

For exmaple the date field in your full calendar table in PowerBI, is not a hierarchy, can we create a hierarchy from this ?

 

Any why is it not happening automatically ?

 

Thank you

Blyton

I'm not sure what you mean, but with drag an drop on the field list you could create your own hierarchy.

 

Hierachy.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegener 

 

In the screenshot you uploaded it is wokring fine. However I tried downloading your file, the date Hierarchy is not create by default.

 

My goal is to create a simple hierarchy from the date = year quarter month day, just like in your screenshot.

 

 And when I try to create this hierarchy as you described desribed above it does not seem to work

 Screenshot

Screenshot 2

 

 

You have to activate the preview feature in the options

Preview Feature.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegenerThankyou worked perfectly

You have to activate the Preview feature in the Options

 

Preview Feature.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


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.