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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Da_clint
Frequent Visitor

If and statements between different tables

Hi im trying to based on 2 conditions from different tables give a decided value or else 0.

 

Have tried to put in a custom column:

 

if([Besparelse] = 1 and (#"Kontoplan"[Mva Norge] =>0 then 0,25 else 0))

 

 

[Besparelse] = from primary table

Kontoplan = is the second table

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Da_clint , In the power query you have to merge tables before you can write some condition across table, AFter merge, they are in a single table.

 

In DAX you can bring the column back into your table

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Da_clint ,

 

Here I create a sample to have a test.

Kontoplan:

RicoZhou_1-1665557026495.png

Primary:

RicoZhou_2-1665557035440.png

Custom column:

RicoZhou_3-1665558676258.png

if [Besparelse] = 1 and 
List.Sum(
let 
_Customer = [Customer]
in
Table.SelectRows(Kontoplan, each [Customer] = _Customer)
[Mva Norge]) >= 0 then 0.25 else 0

Here I add this custom column into Primary table. Result is as below.

RicoZhou_4-1665558719573.png

 

Best Regards,
Rico Zhou

 

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

 

 

Thank you Rico

 

I see that this probably also will work, but I solved it by bringing in the data to the same table & then use a IF && function in DAX

amitchandak
Super User
Super User

@Da_clint , In the power query you have to merge tables before you can write some condition across table, AFter merge, they are in a single table.

 

In DAX you can bring the column back into your table

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.