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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
arcanri
Frequent Visitor

New Table duplicate rows created based on list of all distinct values from other table column

Hello,

I have a price index table (Price Index) that contains price indexes for various categories of price indexes by date.  I also have a formulas table that contains formula parameters for each category and also a formula.  I have the Price Index table and Formulas table related through a Category joiner table.  However, there isn't a relationship between Formula on the Formulas table to the Price Index table.  Ultimately, I would like to create a new table that calculates the Price from the price index utilizing the formula parameters from the Formulas table.  To do so, I'm trying to duplicate the rows of the price index table for each Formula in the Formulas Table.  I should also mention that I will likely add new Formulas over time so I would like this to be a dynamic process where if I add a formula to the Formulas table, new records will be created in teh desired table.  Please see sample tables below:

 

Price Index

DateCategory

Price Index

1/20/2023A

100

1/20/2023B

90

4/15/2023A200
4/15/2023B175
1/1/2024A300
1/1/2024B250

 

Formulas Table

 

FormulaCategoryInterceptSlope
AlphaA-1001.5
AlphaB-901.5
ZuluA-1101.2
ZuluB-1051.1

 

Desired Table

 

DateCategory

Price Index

Formula Name

Calculated Price

1/20/2023A

100

Alpha

150

1/20/2023B

90

Alpha

175

4/15/2023A200Alpha.
4/15/2023B175Alpha.
1/1/2024A300Alpha.
1/1/2024B250Alpha.
1/20/2023A

100

Zulu125
1/20/2023B90Zulu110
4/15/2023A200Zulu.
4/15/2023B175Zulu.
1/1/2024A300Zulu.
1/1/2024B250Zulu.

Thank you!

4 REPLIES 4
hnguy71
Super User
Super User

Hi @arcanri 

Not sure how you're obtaining the calculated price as it doesn't match your slope value. Either way, you can do this via PowerQuery.

 

Step 01: Merge category to category:

hnguy71_0-1731093235308.png

 

Step 02: Expand the Formula name and Slope value:

hnguy71_1-1731093291630.png

 

Step 03: Add a new calculated column to get your new price:

hnguy71_2-1731093324346.png

 

Desired output:

hnguy71_3-1731093348365.png

 

 

 

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Thank you.  Just running into one issue. The Price Index table is a calculated table utilizing dax.  Therefore, I don't see it in Power Query Editor.  Is there any way to import the table into Power Query Editor? Thanks!

Anonymous
Not applicable

Hi @arcanri ,

 

The measure and calculated columns are in DAX , which is M script in power query, so you can't see it in power query. But you can create index columns with built-in functions.

vtianyichmsft_0-1731289788424.png

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @arcanri 

Joins like this is usually accomplished as part of an ETL process but it's possible to achieve this within DAX if you have a calculated table.

Try this instead:

CrossJoin_Table = 

VAR _Base = 
SELECTCOLUMNS(
    FILTER(
        CROSSJOIN(
            SELECTCOLUMNS(Formulas, 
                "f.Formula", Formulas[Formula], 
                "f.Category", Formulas[Category], 
                "f.Intercept", Formulas[Intercept], 
                "f.Slope", Formulas[Slope]
            ),
            SELECTCOLUMNS(PriceIndex, 
                "p.Date", PriceIndex[Date], 
                "p.Category", PriceIndex[Category], 
                "p.Index", PriceIndex[Price Index]
            )
        ),
        [f.Category] = [p.Category]
    ),
    "Formula", [f.Formula],
    "Category", [p.Category],
    "Intercept", [f.Intercept],
    "Slope", [f.Slope],
    "Date", [p.Date],
    "Price Index", [p.Index]
)

VAR _Calculate = 
ADDCOLUMNS( _Base, "CalculatedPrice", [Price Index] * [Slope])

RETURN

_Calculate

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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