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
Serdet
Post Patron
Post Patron

SUM Measure based on a created date

Hi,

 

I have two datasets

Dataset 1

DateIDID TypeEstimate HoursHours Used
01/01/20231Erect1010
02/01/20231Dismantle55

 

Dataset 2

Created DateIDActual Hours ErectActual Hours Dismantle
01/01/20231116
02/01/20231116

 

Dataset 1 & 2 have a relationship between the ID column. 

 

I have two DAX measures

 

Dax measure 1

Calculates the difference in hours from 'Estimate Hours' in Dataset 1 and 'Actual Hours Erect' or 'Actual Hours Dismantle in Dataset 2' depending on the job type given in Dataset 1. 

 

DAX measure 2 (this is shown on a graph visual that plots points on a monthly summary basis)

Calculates producitivty - SUM(dataset1,Estimate Hours) / SUM(dataset1, Hours Used)

 

I need to create a third visual that plots points on a monthly summary basis. 

The logic required is as follows: 

 

IF 'Created Date' in Dataset 2 falls in date timeline on X axis, SUM difference (DAX measure 1) for related 'ID'

 

This should return a plus or minus figure each month if the ID has a created date within that specifc month.

Many thanks,

 

Elliot

 

 

3 REPLIES 3
rusgesig
Helper IV
Helper IV

The sample data you provided wasn't great to work with since the 2 tables you refer to as Dataset 1 and 2 do not have primary keys. I'm still not sure what exactly you want to visualise based on your descriptions, but if you have 2 tables you'd want to join their ID's (preferably 1:1, 1:many if you must, NEVER many:many- which is what you have to do here) and join the date columns to a Calendar. You can inactive relationships in measures.
I even made a sample DS for you, wasn't that nice? Uploaded here since I can't add pbix files https://files.catbox.moe/you93s.pbix

rusgesig_2-1675165430038.png

 

 

rusgesig_1-1675165412387.png

 



rusgesig
Helper IV
Helper IV

Are you using a Calendar table? You need a Calendar connected to both those date columns if you want to display the two measures on a shared x-axis.

Can you provide a screencap of your data model? It's hard to assume when I don't know what your tables look like.

Hi, 

 

Thanks for your quick response.

 

I have attached an example here https://files.catbox.moe/vqr77w.pbix 

 

This shows example data, existing calculated column and difference measure.

 

I need to be able to show the difference on the given timeline but only if the 'Created Date' falls in line with the date in Dataset 1. 

 

For example, if a difference of 10 was shown using the difference measure but its 'Created Date' was 2 months ago. This difference would need to be applied to that date instead of the date in dataset 1.

 

Hope this helps.

 

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.