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
aduhem
New Member

Compare two columns on two different tables and create a new record if the criteria is met

 

Hello, 


I am new to DAX, getting better everyday but I feel like this issue is beyond my reach on my own - hopefully you'll be able to help me. 

 

Issue : I'd like to compare two values from two different tables (on a 1-1 relationship) and if a criteria is met, create a record on a third table. 

 

I don't have permissions to upload images, but I'll explain it as best as I can.

 

My data model is :

  • Table KPI_Today (KPIs of the current day) ;
  • Table KPI_L7D (Average of each KPIs on the last seven days) ; 

The relationship is 1-1 and done on a Primary Key ("Hour" column). 
Both tables have the exact same column names, and I have one line for one hour of the day (so 24 rows fo each of them). 

 

Goal : I want to create a third table which will be called T_Alerts that will compare one KPI (for now, then I'd like to compare more KPIs) from one table to the other same KPI on the other one (on the same hour, which is the PK). 

Example : I want to check if my "Orders" on table KPI_Today is not 20% higher/lower than my "Orders" on KPI_L7D on each hour, and if yes, create a record on the table T_Alerts with the following columns : "Alerte", "Orders", "Hour", "Delta" (the %change). 

Does it make sense ? 
I feel like it's not an easy one but in the same time, I'm sure it has already been done. 

Thanks a lot for any tips, leads, solutions!
Alex

1 REPLY 1
amitchandak
Super User
Super User

@aduhem , If they both are joined, Summarize should allow you to select data from both tables, even if one table is used in table name.

Of the top of that, you can use the filter

 

Filter(Summarize(Table1, Table[Col1], Table2[col2]), [Col1]=[Col2])

 

if they have excat same name then Summarize will not allow rename, You can use selectcolumns for one table.

 

Also refer

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

 

and https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.