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
abukapsoun
Post Patron
Post Patron

Calculated Columns

Hi Dears,

 

I have the following case please: 

 

Column1 Column2

X               Active

Y               Obselete

Z               Active

 

How can I create a new (column or table?) that returns the value of Column1 with a criteria Column2 = Active ? so only X and Z are returned. 

 

Moreover how can I compare two columns and return the differences between both into a new column/ table?

 

Many thanks,

1 ACCEPTED SOLUTION

I would look at using NATURALOUTERJOIN if you are going to do this in DAX:

https://msdn.microsoft.com/en-us/library/dn802527.aspx

 

You could also use a Merge Query in the Query Editor and accomplish this as well, just change the default join type.


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

View solution in original post

6 REPLIES 6
v-yuezhe-msft
Employee
Employee

@abukapsoun,

Select “Active” for Column2 in Visual level filters, and right click on your table, select "New Column" and apply the following formula.

Column = Table1[Column4]-Table1[Column3]

1.JPG

Regards,
Lydia

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

Well, you could use CALCULATETABLE and feed it a filter for Active. Or you could just create a table visualization and use a slicer.

 

To create a new column with the difference between two other columns, just use subtraction?


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

@Greg_Deckler I tried the substraction but it didn't work. In fact, i need to return the difference in rows. 

 

for example if 

Column A

X

Y

Z

 

Column B

Y

Z

 

I want to return a new column with value Z

 

thanks

Now I'm really confused as that doesn't seem to be the same problem that was originally stated.


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

@Greg_Deckler Sorry it seems I have explained myself wrong.

for the first problem it is clear about the calculatedtable with filter = Active 

 

but now I am stuck with returning the differences between the two column. What I want to reach is the following. I have a column that is being updated dynamically. I have duplicated this table and disabled the "load on refresh" then I want to compare both and return what has been newly added compared to that static column which is not refreshing anymore.

I would look at using NATURALOUTERJOIN if you are going to do this in DAX:

https://msdn.microsoft.com/en-us/library/dn802527.aspx

 

You could also use a Merge Query in the Query Editor and accomplish this as well, just change the default join type.


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

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.