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
AbinashBehera
Frequent Visitor

Creating a calculated Measure column based on If else condition of string column from another table.

Hello All,

I am trying to create a calculated column based on below formula, Please suggest how we can write same functionality in DAX for Power BI Reports.

 

Below are my tables joined.

Fact_Table

Dim_Table

 

Calculated Column Logic should be :

case when  Dim_Table.col1 = "Base" then Fact_Table.Measure1 

        When Dim_Table.col1 = "USD" then Fact_Table.Measure2

...

end.

 

 

 

 

Thanks in Advance.

Abinash

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AbinashBehera ,

 

Calculated column and measure are different, you could learn more about it from

Calculated Columns and Measures in DAX - SQLBI

Do you want to return a measure in a calculated column? Here is a similar post that you can refer to:

Solved: Using a Measure in a Calculated Column - Microsoft Power BI Community

 

Measures are calculated on demand based on the report selections, not the refreshed the data. So your measure in the column is calculated on demand, in the case of the column it is at data refresh. 

In other words, measures are dynamic, while calculated columns are static.

 

Also, I helped you move your posts to the Desktop forum, which you posted in the Power Query forum, the M language used in Power Query.

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @AbinashBehera ,

 

Calculated column and measure are different, you could learn more about it from

Calculated Columns and Measures in DAX - SQLBI

Do you want to return a measure in a calculated column? Here is a similar post that you can refer to:

Solved: Using a Measure in a Calculated Column - Microsoft Power BI Community

 

Measures are calculated on demand based on the report selections, not the refreshed the data. So your measure in the column is calculated on demand, in the case of the column it is at data refresh. 

In other words, measures are dynamic, while calculated columns are static.

 

Also, I helped you move your posts to the Desktop forum, which you posted in the Power Query forum, the M language used in Power Query.

 

Best Regards,

Stephen Tao

 

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

Thank you @Anonymous 

So to clear the confusion, I wanted a measure out of a conditional statement.

The problem is, my conditional columns are in Dimension table and the measures are in fact table, so can we write a meausre in this scenario.

And the conditional value needs to be selected by user through slicer. e.g. single selection of Base or USD. 

 

Measure Logic: 

case when  Dim_Table.col1 = "Base" then Fact_Table.Measure1 

        when Dim_Table.col1 = "USD" then Fact_Table.Measure2

end

 

Thanks,

Abinash

NandanHegde
Super User
Super User

Hey,

You can use a combination of Related, Nested IF (or switch)

Assuming the column is being created in fact table and Measure1 is a column
IF (RELATED ( Dim_Table[col1] )="Base",Fact_Table[Measure1],IF (------------repeat------))

You can convert this nested IF to switch :

https://dax.guide/switch/




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

Thank you @NandanHegde 

I tried, but getting below error: 

 

"The column 'Dim_Table.Col1' either doesn't exist or doesn't have a relationship to any table available in the current context."

 

 

 

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 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.

Top Solution Authors