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

Count rows by month for 2 different date columns

Hello,

 

I have a table containing 2 date columns:

 

Sans titre1.png

 

What I want in my visual is the count of Created and Updated by month in the same graph like this:

 

Sans titre.png

 

I can't figure out how to have a common date value for the 2 measures. I guess I need to create a DAX table but I've failed to have the expected result so far. My aggregated data should look like this:

 

Sans titre2.png

 

Regards

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous,

 

You need to create a calendar table check the links below for a DAX and a M code option (just two examples).

 

DAX - https://powerbi.tips/2017/11/creating-a-dax-calendar/

M (Query editor) - https://powerpivotpro.com/2015/02/create-a-custom-calendar-in-power-query/

 

Then create an inactive relationship between your calendar table and your two columns and add the following measures:

 

Created count = CALCULATE(COUNT(DatesLog[Created on]);USERELATIONSHIP(DatesLog[Created on];DimDate[Date]))

Updated count = CALCULATE(COUNT(DatesLog[Updated on]);USERELATIONSHIP(DatesLog[Updated on];DimDate[Date]))

Add the month from the dates table on your x-axis and the measures on your values, this will give you the result below:

userrelation.png

 

Regards

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @Anonymous,

 

You need to create a calendar table check the links below for a DAX and a M code option (just two examples).

 

DAX - https://powerbi.tips/2017/11/creating-a-dax-calendar/

M (Query editor) - https://powerpivotpro.com/2015/02/create-a-custom-calendar-in-power-query/

 

Then create an inactive relationship between your calendar table and your two columns and add the following measures:

 

Created count = CALCULATE(COUNT(DatesLog[Created on]);USERELATIONSHIP(DatesLog[Created on];DimDate[Date]))

Updated count = CALCULATE(COUNT(DatesLog[Updated on]);USERELATIONSHIP(DatesLog[Updated on];DimDate[Date]))

Add the month from the dates table on your x-axis and the measures on your values, this will give you the result below:

userrelation.png

 

Regards

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Works perfectly, thanks!

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.