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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
gemcityzach
Helper III
Helper III

Use Calendar for Time Intelligence on another Table with Multiple Dates

What do you think the optimal way to plot muliple dates from the same table would be in a combo column-line chart?

 

I have work units that have a 'Created' date and a 'Closed' date. I want to implement good PowerBI practices so I created a Calendar table and I've linked Created date to the 'Date' field in the Calendar column. However, I cannot have more than one active relationship.

 

On my column chart I want to plot the number of items created and then the secondary line plot should show the number of items closed in that same month. And I want the x-axis to show Month-Year as opposed to Month-Day like it is now.

 

Is there a way to do this and to use the calendar table for both Date fields (created, closed)?2024-04-18_13-58-07.png

1 ACCEPTED SOLUTION

@gemcityzach Yeah, doesn't work that way other than perhaps overlaying two visuals but that's a mess. Better to create a measure for the closed count of ids like this:

Closed Count Measure = 
  VAR __Date = MAX('Date'[Date])
  VAR __Table = FILTER( ALL('Table'), [Closed Date] = __Date )
  VAR __Result = COUNTROWS( __Table )
RETURN
  __Result

@ 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...

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

@gemcityzach 
Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365

 

If not, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ 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...

hey greg thanks for responding! those two options look nice but not quite what im looking for. sample data:

 

IDGroupEvent_TypeCreatedClosedDueDatePastDue
1Group1A;C03/01/2024null03/15/2024Yes
2Group2B 03/15/2024null03/30/2024Yes
3Group3A04/12/202404/18/2024 04/27/2024Yes
4Group1B;A 04/01/202404/18/202404/16/2024No
5Group1A;B;C 04/15/202404/18/202404/27/2024No

 

Column Chart X: Month-Year Created

Column ChartY: Count of IDs

Line X: Month-Year Closed

Line Y: Count of IDs

@gemcityzach Yeah, doesn't work that way other than perhaps overlaying two visuals but that's a mess. Better to create a measure for the closed count of ids like this:

Closed Count Measure = 
  VAR __Date = MAX('Date'[Date])
  VAR __Table = FILTER( ALL('Table'), [Closed Date] = __Date )
  VAR __Result = COUNTROWS( __Table )
RETURN
  __Result

@ 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...

Hey Greg that worked pretty well for me to convert it to a stacked bar chart. But now none of my on-page slicers work. I'm guessing I need to figure out a way to keep the 'Group' filter?

 

Edit: I changed FILTER ( ALL ) to FILTER ( KEEPFILTERS ...) and that worked! 🙂 Do you know how I might get the X-Axis to show Month-Year instead of MMM-DD?

@gemcityzach Also, you could have used ALLSELECTED instead of ALL


@ 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...

@gemcityzach That's typically done in your formatting for the column.


@ 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...

Yeah I checked for that but it doesn't offer the ability to 'group' the data into months. There are just variations on MM-DD-YYYY. I used the SQIBI calendar template (DAX Date Template - SQLBI).

 

2024-04-18_16-12-18.png

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.