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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Silvard
Resolver I
Resolver I

Iterate over two different columns/tables

Hi,

 

The below measure is mostly producing the correct result, but given SQLBI recommend not to create calculated columns within summarize and instead use addcolumns to do so, I'm looking for a better solution.

 

Ive already tried their recommendation but unfortunately it creates the same max created date value across all rows and the iteration fails severely.

 

Essentially, I want to work out the date difference between the Created Date and the Assessment End within the context of current dates/period (eg, a line chart showing years)

These two columns do not share the same key and are both connected to the fact table.

 

Your help and input is much appreciated!

 

Time = 
VAR FilteredAssessments = CALCULATETABLE(Assessments,Assessments[Assessment Step - Name] = "Condition1" && MAX(Assessments[End]))

	VAR VirtualTable = 
	SUMMARIZE(FilteredAssessments,Assessments[Assessment Step ID],Assessments[End],"Created",CALCULATE(TRUNC(MAX(Jobs[Created])),TREATAS(VALUES(Facts[JobID]),Jobs[JobID]),USERELATIONSHIP(Jobs[Created],'Calendar'[Date])))
	
    RETURN
    AVERAGEX(VirtualTable,DATEDIFF([Created],TRUNC(Assessments[End]),DAY)))

 

3 REPLIES 3
Anonymous
Not applicable

Hi, @Silvard 

Based on your description, it's hard to figure out what you expect to achieve. You can share the pbix file without sensitive data and give your desired implementation.

Best Regards,
Yang

Community Support Team

Hi @Anonymous 

 

Thank you for your response.

 

I would like to get the datedifference between two dates from different tables that are only "connected" via the facts table. The keys of their respective tables are not at the same granularity and as such can't be connected to each other.


The measure will be used in a line chart detailing time period and should respond accordingly.

 

 

 

Anonymous
Not applicable

Hi, @Silvard 

You can describe your needs with specific data, which can help realize your output faster.

Best Regards,
Yang

Community Support Team

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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