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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Creating Calculated Tables For 3 Different Conditions

tksnota_0-1727814415186.png

 

Condition 2: If Sales Group from Table 1 is IC then calculated column will be IC.

 

Condition 3: From Table 1, if Sales Group is not IC and Type2 is COGS then copy Data from New Consol in the calculated column

 

//tksnota

1 ACCEPTED SOLUTION
muhammad_786_1
Solution Supplier
Solution Supplier

Hi @Anonymous 

 

Try this:

CalculatedColumn = 
IF(
    Table1[SalesGroup] = "IC", 
    "IC",  -- Condition 2
    IF(
        Table1[Type2] = "Sales", 
        LOOKUPVALUE(Table2[ItemCode], Table2[SalesGroup], Table1[SalesGroup]),  -- Condition 1
        IF(
            Table1[Type2] = "COGS", 
            FORMAT(Table1[New Consol], "NA"),  -- Condition 3
            BLANK()  
        )
    )
)

muhammad_786_1_0-1727817650892.png

 

Best,
Muhammad Yousaf

 

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

 

LinkedIn

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous, hello Ashish_Mathur and muhammad_786_1, thank you for your prompt reply!

 

Please try as follows:

 

CalculatedColumn = 
SWITCH(
    TRUE(),
    
    -- condition2
    Table1[SalesGroup] = "IC", 
    "IC",
    
    -- condition1:  SalesGroup <> IC and Type2 =Sales, use GLAccount, Costcenter, CostUnit and Project from Table2 to search ItemCode
    Table1[Type2] = "Sales" && Table1[SalesGroup] <> "IC",
    LOOKUPVALUE(
        Table2[ItemCode], 
        Table2[GLAccount], Table1[GL_Cod], 
        Table2[Costcenter], Table1[Cost_Center], 
        Table2[CostUnit],Table1[Profit_Center],
        Table2[Project], Table1[Project]
    ),
    
    -- condition3:  SalesGroup <> IC and Type2 = COGS,return New Consol 
    Table1[Type2] = "COGS" && Table1[SalesGroup] <> "IC",
    Table1[New Consol],
    
    -- default
    BLANK()
)

 Result:

vyajiewanmsft_0-1727836056092.png

Best regards,

Joyce

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

Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
muhammad_786_1
Solution Supplier
Solution Supplier

Hi @Anonymous 

 

Try this:

CalculatedColumn = 
IF(
    Table1[SalesGroup] = "IC", 
    "IC",  -- Condition 2
    IF(
        Table1[Type2] = "Sales", 
        LOOKUPVALUE(Table2[ItemCode], Table2[SalesGroup], Table1[SalesGroup]),  -- Condition 1
        IF(
            Table1[Type2] = "COGS", 
            FORMAT(Table1[New Consol], "NA"),  -- Condition 3
            BLANK()  
        )
    )
)

muhammad_786_1_0-1727817650892.png

 

Best,
Muhammad Yousaf

 

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

 

LinkedIn

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.