Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dominikRieder
Frequent Visitor

Left-outer-join on "Dax Created" Calendar table

Hello everyone,

 

I am currently struggeling with an issue which seems to be a simple problem, but not simply solvable with Power BI

 

Lets say I have a Table "TicketInformation". The data of this table comes from a SQL-Database and is created with a power Query command.

Every ticket has a "date" field.

 

Then I have a second table called "Calendar" created with the DAX Function:

Kalender = CALENDAR(
DATE( YEAR( TODAY() ); MONTH(TODAY()) - 3; 1);
DATE( YEAR( TODAY() ); MONTH(TODAY()); EOMONTH(MONTH(TODAY()); 0)
))
It creates dates for the last three months
 
The Goal is to show the Amount of time spend for all Tickets per day on a line chart, something like this:
Unbenannt.PNG
 
Unfortunately the "Null" values are not handled correctly. On weekends e.g there are no entries in the tickettable but still it is not shown as zero in the line chart (instead a straight line which "skips" the days").
 
The Relationship has been set accordingly to a one-to-many between the Calendar table and the Tickettables "Date" column.
(Clicking "show elements with no data" does not change anything)
 
In my second approach I wanted to create a new table with a Left-outer-Join between calendar table and Tickettable. Unfortunately the Calendar Table does not appear as an available Table for merging, when going through "edit queries -> merge queries".
 
What is the best way to create a table that contains every single date from Calendar and all matching dates from Ticket-table or null if not available?
 
Any help is appreciated very much.
 
Best Regards,
Dominik
1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi @dominikRieder 

Try a measure like this:

Amount of time spent =
VAR _timeSpent =
    SUM ( 'Table'[duration] )
RETURN
    IF ( ISBLANK ( _timeSpent ); 0; _timeSpent )

 If in your calendar table is a date without match in your TicketInformation table, it will return 0 instead of blank. Just make sure your calendar table is resonable. E.g. a typical situation is that you have a budget table that runs until the end of the year, so the date table needs to dates until 31.12. Which means for every day from today untill 31.12, this measure will return 0, which might be undesired behaviour. You can work around this by adding a column, e.g. IsPastDates, in you calendar which is 1 when date<=today(), and filter your visual by this IsPastDates = 1.

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

 

View solution in original post

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi @dominikRieder 

Try a measure like this:

Amount of time spent =
VAR _timeSpent =
    SUM ( 'Table'[duration] )
RETURN
    IF ( ISBLANK ( _timeSpent ); 0; _timeSpent )

 If in your calendar table is a date without match in your TicketInformation table, it will return 0 instead of blank. Just make sure your calendar table is resonable. E.g. a typical situation is that you have a budget table that runs until the end of the year, so the date table needs to dates until 31.12. Which means for every day from today untill 31.12, this measure will return 0, which might be undesired behaviour. You can work around this by adding a column, e.g. IsPastDates, in you calendar which is 1 when date<=today(), and filter your visual by this IsPastDates = 1.

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.