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

Date relationships not working

Hi all,

 

Two different sources, linked by dates, but can't get a visual with 2 bars each month
(green bar ok, grey bar not ok):

 

test.png

 

here is a look at the two linked dates:

 

test4.png

 

 

 

test2.png

 

test3.png

 

thanks for your help

 

1 ACCEPTED SOLUTION

You should use a Date table an create relationships to both tables. Then in the chart use the Month of the Dates table to see the amounts.

Date tables must contain continuous dates.

 

Regards

View solution in original post

7 REPLIES 7
rockdrigom
Advocate I
Advocate I

You should create a new colum with something like STARTOFMONTH(IssuedAt) to get the same value in both tables.

Then make the relationship with the new column.

Regards 

Rodrigo

@Greg_Deckler: same date type : dd/mm/yyyy. I tried with a solution you gave elsewhere like = MONTH([date]) & YEAR([date]) but I get 

"Expression error: The name 'MONTH' wasn't recognized. Make sure it's spelled correctly."

 

@rockdrigom: "get the same value in both tables." => sure, got it, thanks!

 

I'm just beginnig with PBI...I get the following error:

 

"Expression error: The name 'STARTOFMONTH' wasn't recognized. Make sure it's spelled correctly."

 

 

I think I don't enter DAX correctly...

 

best,

@adrien5555 You are in power bi desktop right?

 

1.JPG

 

 

Regards

 

Rodrigo

@rockdrigom: yes in PBI. But I was in the Query Editor 🙂

 

Actually, it's very unclear to me when to edit data in the Query Editor and when to do it in the modeling... 

 

Doing the formula in modeling works great, and i updated the relationship

 

It's getting much better :

 

test.png

 

but the grey bar doesnt display the good number for each month: either a total or average

 

 

You should use a Date table an create relationships to both tables. Then in the chart use the Month of the Dates table to see the amounts.

Date tables must contain continuous dates.

 

Regards

@rockdrigomThanks! This is really a best practice I hadn't read so far... Microsoft should create a tutorial to cover this. I guess the date table and country table are probably the most used.

Greg_Deckler
Super User
Super User

Looks like your dates are in 2 different formats, might try making them both mm/dd/yy or dd/mm/yy. Blanks generally indicate nont-matching rows in a relationship.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.