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
Marcus_swe
Frequent Visitor

Change over time - Relations & Best Practice

Hi, 

So i am struggeling to figure out how to handle different change of time cases. I am new to DAX and Power Bi but have played around with it for a couple of weeks.

I dont know if i am setting everything up fundamental wrong or if it just some small error along the way. 

This is the first time i am trying to build a report that shows change of time and uses a dedicated calendar table. 

 

So, hit me up with your best links/tips for best practice regarding change over time! 

 

I want do several things, for example:

Change of amout of parts over time

Change of cost over time

Compare MoM, YoY etc etc

 

But i cant get the relation between the date calender to work.

 

The data i have contains of 2 excel files and a calculated calander table. 

excel file 1: Live data, updated daily

excel file 2: History data, is a compiled over time version of the Live data sheet. So basicly a datadump of the "Live Data", exactly the same columns but data with a date stamp when the data was updated.

 

Format of the data is like this:

Updated from DatabasePart noTarget CostActual CostMore info coumns
--->
2019-04-04720   
2019-03-04720             
2019-02-04720          
2019-01-04720             
2018-12-04720   

 

Calculated Calender based on this:

Date = 
 ADDCOLUMNS (
 CALENDAR (DATE(2019;01;01); DATE(2020;01;01));
"Today";today();
"Yesterday";today()-1;
"DateAsInteger"; FORMAT ( [Date]; "YYYYMMDD" );
 "Year"; YEAR ( [Date] );
 "Monthnumber"; FORMAT ( [Date]; "MM" );
 "YearMonthnumber"; FORMAT ( [Date]; "YYYY/MM" );
 "YearMonthShort"; FORMAT ( [Date]; "YYYY/mmm" );
 "MonthNameShort"; FORMAT ( [Date]; "mmm" );
 "MonthNameLong"; FORMAT ( [Date]; "mmmm" );
 "WeekNo"; Format ([Date]; "ww");
  "DayOfWeekNumber"; WEEKDAY ( [Date] );
 "DayOfWeek"; FORMAT ( [Date]; "dddd" );
 "DayOfWeekShort"; FORMAT ( [Date]; "ddd" );
 "Quarter"; "Q" & FORMAT ( [Date]; "Q" );
 "YearQuarter"; FORMAT ( [Date]; "YYYY" ) & "/Q" & FORMAT ( [Date]; "Q" );
 "Heute -1 ";if([date]>=NOW()-2;"Y"; "N");
 "Heute -2";if([date]>=NOW()-3;"Y"; "N");
"Date-1";[Date]-1   )

 

Issue:

Let start easy and say i want to create a tabel showing total number of parts per week.

I create a "one to many" relation between date calender and history data. 

Change_Over_Time_Relation.png

 

When i proceed to create a table i get this result:

 

Change_Over_Time_example.png

I dont know why i cant get it to work. I have some thoughts that my history data is formatted in an incorrect way.

So, have I misunderstood the basics or is there something else that is fishy here?

 

 

 

 

 

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

hi, @Marcus_swe 

Please check if the format type Updated from Database is datetime when it is imported. if so, please add a date column by DATE Function

Column = DATE(YEAR(Table1[Updated from Database]),MONTH(Table1[Updated from Database]),DAY(Table1[Updated from Database]))

If not your case, there is something wrong in other steps, please share your sample pbix file for us to have a test.

By the way, for your other requirement, try time-intelligence-functions in dax or have a try on quick measures in power bi desktop.

https://docs.microsoft.com/en-us/dax/time-intelligence-functions-dax

https://docs.microsoft.com/en-us/power-bi/desktop-quick-measures

 

Best Regards,

Lin

 

Community Support Team _ Lin
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

3 REPLIES 3
tex628
Community Champion
Community Champion

Hello! 

Starting off it appears that there is something incorrect with the relationship. If you could post a picture of your datecolumn in the History table we might be able to figure out the issue! 🙂 

/ Johannes


Connect on LinkedIn
v-lili6-msft
Community Support
Community Support

hi, @Marcus_swe 

Please check if the format type Updated from Database is datetime when it is imported. if so, please add a date column by DATE Function

Column = DATE(YEAR(Table1[Updated from Database]),MONTH(Table1[Updated from Database]),DAY(Table1[Updated from Database]))

If not your case, there is something wrong in other steps, please share your sample pbix file for us to have a test.

By the way, for your other requirement, try time-intelligence-functions in dax or have a try on quick measures in power bi desktop.

https://docs.microsoft.com/en-us/dax/time-intelligence-functions-dax

https://docs.microsoft.com/en-us/power-bi/desktop-quick-measures

 

Best Regards,

Lin

 

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

Hi, @v-lili6-msft  Thank you for the reply. 

 

It was the format of my date column that was incorrect. 

I did not know that it was such a differance between Date or Date/Time. 

 

I now got it to work as i tought. 

Off to the next challenges Smiley Happy

 

**Big thanks for the links aswell! 

 

//Marcus

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.