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

How to connect calender table correctly

Hi.

 

How do I create a month-relationship between these tables? I have a column called "Måned"(month) in every table and I have my calender table in the middle but the tables do not react correctly to the calender table in visualization 🙂

 

lavmads_1-1678106028483.png

 

Best regards,

Lisa 

 

1 ACCEPTED SOLUTION

hi @Anonymous

Aha, then you need to convert the month name to month numbers first

try like:
Date2 =
VAR _monthnum =
SWITCH(
[monthname],
"January", 1,
"February", 2,
" March", 3,
"April", 4,
"May", 5,
"June", 6,
"July", 7,
"August", 8,
"September", 9,
"October", 10,
"November", 11,
12
)
RETURN
DATE ([Year], _monthnum, 1)

View solution in original post

8 REPLIES 8
Raj2410
Helper I
Helper I

Hi I have a similar situation my summary table has multiple dates.

My calender table was created and added.

I connected calender date with summary tables work date.

 

 

Raj2410_0-1679318720958.png

The problem is when I go to visual shown below and filter January .

It filters out the equipments that don't have any date but I want to keep all 1324 equipment evern after month is filtered.

 

see belwo may be this will explain better.

 

Raj2410_1-1679318946257.png

 

Anonymous
Not applicable

But what if I dont have an actual date for the other tables and I only have the month? 

hi @Anonymous 

you can rebuild a date column. Try add in each tables a calculated column like:

Date =DATE ([Year], [Month], 1)

Anonymous
Not applicable

@FreemanZ I dont know if I understand it correctly. I tried to insert your calculated column in different ways but it does not work. 

lavmads_1-1678111459542.png

 

 

lavmads_0-1678111407833.png

 

hi @Anonymous

Aha, then you need to convert the month name to month numbers first

try like:
Date2 =
VAR _monthnum =
SWITCH(
[monthname],
"January", 1,
"February", 2,
" March", 3,
"April", 4,
"May", 5,
"June", 6,
"July", 7,
"August", 8,
"September", 9,
"October", 10,
"November", 11,
12
)
RETURN
DATE ([Year], _monthnum, 1)

Anonymous
Not applicable

@FreemanZ Thank you, that worked! 🙂

Fowmy
Super User
Super User

@Anonymous 
Make sure to have a date type column with month end date for the column "Måned" in each table to which you need to connect the calendar table, then, you should be able to create a One-To-Many relationship.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

FreemanZ
Super User
Super User

hi @Anonymous 

because your month column in the calendar table is not unique. 

 

try to connect all tables with the calendar on date column and always pull dimensional fields from calendar table, like month, year. 

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.