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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
madji
Helper I
Helper I

multiply two columns from diferent table

HI

I have one problem with dax.

 

How can I  multiply two cells from different table

 

For example I want to get A*B. it work, but for total is not correct.  I want to see sum 50 + 1400 

 

Screenshot_2.png

 

 

 

Screenshot_3.png

1 ACCEPTED SOLUTION

Hi @madji,

 

Maybe you can try this formula.

Measure1 =
IF (
    HASONEFILTER ( Table1[Column1] ) || HASONEFILTER ( Table2[Column1] ),
    SUM ( Table1[A] ) * SUM ( Table2[B] ),
    SUMX (
        SUMMARIZE (
            'Table1',
            'Table1'[Column1],
            'Table1'[A],
            'Table2'[B],
            "product", 'Table1'[A] * 'Table2'[B]
        ),
        [product]
    )
)

multiply_two_columns_from_diferent_table

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

See this post:

 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

 


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

https://yadi.sk/d/OwlJzzG33QPaZV

 

Link to my examle.

 

And I think  total is not correct.  I want to see sum 50 + 1400 

Hi @madji,

 

Maybe you can try this formula.

Measure1 =
IF (
    HASONEFILTER ( Table1[Column1] ) || HASONEFILTER ( Table2[Column1] ),
    SUM ( Table1[A] ) * SUM ( Table2[B] ),
    SUMX (
        SUMMARIZE (
            'Table1',
            'Table1'[Column1],
            'Table1'[A],
            'Table2'[B],
            "product", 'Table1'[A] * 'Table2'[B]
        ),
        [product]
    )
)

multiply_two_columns_from_diferent_table

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot 😃 

It is really amazing) 

Hi @madji,

 

You are welcome. I just realized it could be simpler in your scenario. Please try this one.

Measure3 = sumx(
	SUMMARIZE('Table1',
			'Table1'[Column1],
			'Table1'[A],
			'Table2'[B],
			"product", 'Table1'[A] * 'Table2'[B]),
			[product])

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.