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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jbstephenson
New Member

Create calculated column in Table2 that can be sliced using fields from Table1

My objective is to be able to create a visual (a column chart) with Table2[Arbitrary date] as the X-axis and the Table2[Calculated column] as the Y-axis. I need to be able to have this chart affected by slicers from Table1. For example, the calculated column in Table2 should change values when Table1[color] is used as a slicer and "Yellow" is selected. Everything I've researched indicates that a relationship is required (maybe that's not the case), but I don't know how one could create a relationship between the two tables that accomplished my objective. 

 

 

Here is an example Table1:

 

Serial numberLocationProduct typeColorDate receivedDate processedDate shipped
101TXUsedBlack10/1/202210/31/202211/30/2022
102TXNewBrown10/2/202211/1/202212/1/2022
103TXRefurbishedYellow10/3/202211/2/202212/2/2022
104TXUsedPink10/4/202211/3/202212/3/2022
105TXNewBlack10/5/202211/4/202212/4/2022
106ARRefurbishedBrown10/6/202211/5/202212/5/2022
107ARUsedYellow10/1/202210/31/202211/30/2022
108ARNewPink10/2/202211/1/202212/1/2022
109ARRefurbishedBlack10/3/202211/2/202212/2/2022
110ARUsedBrown10/4/202211/3/202212/3/2022
111ARNewYellow10/5/202211/4/202212/4/2022
112ARRefurbishedPink10/6/202211/5/2022

12/5/2022

 

Here is an example Table2, column "Calculated column" being the crux of my question:

 

Arbitrary dateCalculated column
10/2/2022=calculate(…
10/9/2022=calculate(…
10/16/2022=calculate(…

 

Here is what I've tried (with no success) for the calculated column:

 

=calculate( count(table1[serial number]) ,table1[date received] > table2[arbitrary date], table1[date processed] > table2[arbitrary date] )

 

 

1 ACCEPTED SOLUTION

Hi @jbstephenson,

 

I'm this case you need to create a measure to make the calculation dinamically try the following.

 

Measure =

=countrows(FILTER(table1 ,table1[date received] >MAX( table2[arbitrary date]) & & table1[date processed] > MAX( table2[arbitrary date] )) 


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

4 REPLIES 4
MFelix
Super User
Super User

Hi @jbstephenson ,

 

To create a relationship between tables you need to follow this guidance.

 

https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-create-and-manage-relationships

 

But in this case I have some doubts you refer that you want to have a filter on the colour? does this means that you want the calculated table to be dinamic based on selection?

 

 


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



Yes, I need it to be dynamic based on selection

Hi @jbstephenson,

 

I'm this case you need to create a measure to make the calculation dinamically try the following.

 

Measure =

=countrows(FILTER(table1 ,table1[date received] >MAX( table2[arbitrary date]) & & table1[date processed] > MAX( table2[arbitrary date] )) 


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



Ah, you're right, thanks! I had also tried a measure using CALCULATE with filter arguments instead of just using FILTER.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.