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
irnm8dn
Post Prodigy
Post Prodigy

Date Formatting & Date Comparison - Formatting and DAX Help

I have a data set which has 3 columns, all with date relevant informaiton for my report.  I am trying to understand how to best format this information so that Power BI will allow me to compare Annual, Quarterly and Monthly Results.

 

I have provided a sample data set for anyone who want to take this for a test drive.

 

https://www.dropbox.com/s/ru4bnd55noqccef/Sample%20Date%20Sheet.xlsx?dl=0

 

I would like to do Quarter vs. Quarter, Year over Year, and Month over Month Analysis as well as write a DAX statement that shows the difference between the time periods.

 

Any assistance with the formatting of the data recommendations on how to compare the different time periods would be greatly appreciated.

 

Thank you.

12 REPLIES 12
Vvelarde
Community Champion
Community Champion

Hi @irnm8dn

 

Follow this video to transform your column in a date column.

 

 

After that use this date column to relation with a calendar table and made your dax to compare years, quarters, month, etc.

 

 

 




Lima - Peru

@Vvelarde @Sean

 

This is great information, very helpful.

 

The only remaining part I am having difficulty with is table in which the relationship is made.  In @Vvelarde video.

 

I created a date table, but editing the relationships will not allow me to proceed.  Also, notice the "line" between the two tables, it does not look like the one seen in the video.

 

Cal 1.PNGCal 2.PNG

@Sean @Vvelarde

 

Any additional insight you may be able to provide?  Really struggling applying the solution and making the connection in the model.

 

Thanks again.

Vvelarde
Community Champion
Community Champion

@irnm8dn

 

Can you post your entire Window (Relationship), I saw in your screenshot that the relationship is made, why you want to change that.

 

 




Lima - Peru

@Vvelarde

 

Happy to post whatever information you need, and thank you again for the help.  

 

It would appear that the relationship doesn't work the same way as in your video - and I cannot figure out why.  I think it is probably with the Date Table I created.

 

Relationship Table.PNG

 

Anonymous
Not applicable

@irnm8dn Try changing your cardinality from One:Many to Many:One instead. The order in the cardinality is the order the tables are listed in the relationship. In your case, the date table is second, so you want the cardinality with the "One" on the right hand side.

@Anonymous

 

Thanks I made the change.  Unforunatley, this is the informaiton that the slicer ouputs.

 

I don't know why the slicer is limiting it to these 2 options (fig. A), the dataset itself is clearly more expansive. (fig. B)

 

fig. A

 

Qtr-Yr.PNG

 

(fig. B)

 

 

 Date Sample.PNG

Anonymous
Not applicable

@irnm8dn could you post your .pbix so we can take a look? It will be hard to troubleshoot without looking into the data model in Power BI.

@irnm8dn

 

The cardinality is:

 

DateTable - One   to Many DateREF

 

With this the error dissapear and relationships will work.

 

 




Lima - Peru
Sean
Community Champion
Community Champion

@irnm8dn

first create the DateRef column as per @Vvelarde's video

then its much easier to get the month number as shown below...

Add Column tab => Date => Month

 

Query Editor - DateRef.gif

 

BTW I do like the Conditional Column Interface its just that the above is much easier in this case Smiley Happy

 

Does anyone know - is there a limit on how many conditions can be entered in the Conditional Column UI in the Query Editor?

@Vvelarde, @ImkeF, @MarcelBeug

Vvelarde
Community Champion
Community Champion

@Sean

 

How can i create the animated image(gif)? Thanks

 

 




Lima - Peru
Sean
Community Champion
Community Champion

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.