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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BobKoenen
Helper IV
Helper IV

Measure for Sum from 2 tables with added text column

Hi All,

 

I have Dim table [customer] and 2 fact tables which I cannot append or merge. 

Customerid
JoeA
JaneB
JosephC

Fact table 1

IdAmount
A500
B400
C100

Fact table 2

IdAmount
B1000

 

Now I want the measure to Sum the amount of [fact table 2] and (the amount of [fact table 1] Exept for the id`s that are present in the [fact table 2]). So Each id gets only included once. I also want a text for each row indicatin from which fact table the amount is taken. 

 

Result:

CustomerAmountOrigin
Joe50Fact table 1
Jane1000Fact table 2
Joseph100Fact table 1

 

Hope you can help me

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @BobKoenen

I think it would be best to do this in PQ but see the file attached for a possible solution through measures as requested

 

Amount_M = 
VAR fT2_ = SELECTEDVALUE(FTable2[Amount])
RETURN
IF(ISBLANK(fT2_), SELECTEDVALUE(FTable1[Amount]), fT2_)  

 

 

 

Origin_M = 
VAR fT2_ = SELECTEDVALUE(FTable2[Amount])
RETURN
IF(ISBLANK(fT2_), "FTable1", "FTable2")  

 

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

1 REPLY 1
AlB
Super User
Super User

Hi @BobKoenen

I think it would be best to do this in PQ but see the file attached for a possible solution through measures as requested

 

Amount_M = 
VAR fT2_ = SELECTEDVALUE(FTable2[Amount])
RETURN
IF(ISBLANK(fT2_), SELECTEDVALUE(FTable1[Amount]), fT2_)  

 

 

 

Origin_M = 
VAR fT2_ = SELECTEDVALUE(FTable2[Amount])
RETURN
IF(ISBLANK(fT2_), "FTable1", "FTable2")  

 

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors