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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
RG007
Helper II
Helper II

create new column or measure using Coalesce on two different tables

Hi I have a fact table say fact1 and two dim tables dim1 and dim2 both dimension tables are joined with fact table using their dimid.

I need to create a calculated column or measure like if ( dim1.dimid=-1) then dim2.name else dim1.name

I will prefer this new column in fact table, but it can be anywhere.

 

Thanks

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

Hi @RG007 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @RG007 ,

You could merge these three tables and then use the following formula:

Measure =
IF (
    MAX ( 'Merge1'[DimID] ) = -1,
    MAX ( 'Merge1'[Dim2.Name] ),
    MAX ( 'Merge1'[Dim1.Name] )
)

Or you could creata a new calculated table 

Calculated Table =
SUMMARIZE (
    'Fact',
    'Fact'[Index],
    'Fact'[DimID],
    "Name", IF ( MAX ( 'Fact'[DimID] ) = -1, MAX ( 'Dim2'[Name] ), MAX ( 'Dim1'[Name] ) )
)

10.22.6.1.PNG

 Here is the pbix file.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

Best Regards,
Eyelyn Qin

amitchandak
Super User
Super User

@RG007 , Try a new measure like .

if(max(dim1[dimid])=-1, max(dim2[name]) , max(dim1[name]))

 

A column is only possible if there are have some kind of relation

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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