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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
adriancho_BI
Regular Visitor

Create New Column referencing other table's column

Hello! Please your hel in figuring out how to Create a New Column referencing other table's column
In a single record table, I want to count, how many times repets a certain column per this single record column/table
table 1: ID table, one row per ID
table 2: fact table, many transactions for every ID
I need to count how many "products" are associated per ID in a new column, because my next step is to create a range column to use in a later biz.

 

THANK IN ADVANCE FOR THE HELP!

My goal is to see something like this:

IDQ_PRODSQ_PRODS_GROUP
A00
B11
C22
D55>=3
1 ACCEPTED SOLUTION

Thank  you for the response, but I already have the count, what I actually need is to create the group or category using something like SWITCH() OR IF() but when I visualize it, it only shows me the last category ">=3". I already checked the data format as WHOLE NUMBER with zero decimals

e.g.:

Column =
IF( MAX('dimbakery'[count]) = 0, "0",
IF(MAX('dimbakery'[count]) = 1 , "1",
IF(MAX('dimbakery'[count]) =2 , "2" ,
IF(MAX('dimbakery'[count]) >= 3 ,">=3"))))
or 
Column =
SWITCH (
MAX('dimbakery'[count]),
0, "0",
1, "1",
2, "2",
">=3")


View solution in original post

2 REPLIES 2
Bipin-Lala
Super User
Super User

Hi @adriancho_BI,

 

Let's assume the below mentioned dimBakery and factBakery tables as examples - 

BipinLala_0-1711060715691.pngBipinLala_1-1711060755176.png

  • You must be having a one-to-many relationship flowing from dimBakery to factBakery table
  • To count the number of records for each dim table ID present in the fact table, we can use the following formula 
Bakery Sale Record Count = CALCULATE(COUNT(factBakery[ID]), USERELATIONSHIP(dimBakeryItems[ID], factBakery[ID]))
  • This will create a column in dimBakery table, counting the number of transactions in factBakery table.
BipinLala_2-1711060942042.png

In general, if you want to refer to a column from another table for calculation, you can use the RELATED function, provided there is a relationship between the 2 tables.

Or you can also use LOOKUPVALUE as well, depending upon requirements.

 

Let me know if this helps you out with your requirements. If it doesn't, can you please share some sample data or your pbix file, which can then help me provide an exact solution for your requirements?




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

Proud to be a Super User!


Regards,

Bipin Lala | Business Intelligence Developer



Thank  you for the response, but I already have the count, what I actually need is to create the group or category using something like SWITCH() OR IF() but when I visualize it, it only shows me the last category ">=3". I already checked the data format as WHOLE NUMBER with zero decimals

e.g.:

Column =
IF( MAX('dimbakery'[count]) = 0, "0",
IF(MAX('dimbakery'[count]) = 1 , "1",
IF(MAX('dimbakery'[count]) =2 , "2" ,
IF(MAX('dimbakery'[count]) >= 3 ,">=3"))))
or 
Column =
SWITCH (
MAX('dimbakery'[count]),
0, "0",
1, "1",
2, "2",
">=3")


Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.