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
Anonymous
Not applicable

Create Column on transactions Level based on transactions Level

Hi Community,

 

So what i am trying to achieve is the following:

 

TransactionIDItemIDR-PriceFLAG
37700791050546619198621.31Y
37700791050546618605421.3Y
3770079105054661860890Y
37700895050546617456425N
3770089505054669456322.5N

 

As you can see, i have a table with TransactionID, ItemID and the Sales Price (R-Price).

 

I need to create a FLAG column which can be used as a Filter to include or exclude all TransactionID's that have at least one item with a 0 value.

 

I have managed to achieve this in Power Query. However, the performances are slow. Can anyone give me any direction on how to do this in DAX?

 

Thanks,

 

Laz

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may refer to the DAX below.

Column =
CONTAINS (
    Table1,
    Table1[TransactionID], Table1[TransactionID],
    Table1[R-Price], 0
)
Community Support Team _ Sam Zha
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
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may refer to the DAX below.

Column =
CONTAINS (
    Table1,
    Table1[TransactionID], Table1[TransactionID],
    Table1[R-Price], 0
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you for this 🙂

LivioLanzo
Solution Sage
Solution Sage

hI @Anonymous

 

what is the logic behing the flag? Are you extracting the data from a databse? this could be pused back to the database engine.

If you need to do this in Power Query, then it is faster if you create a mapping table with the logic built in and then create a Merge

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

Hi @LivioLanzo,

 

The logic is, we have some items in transactiosn which have a 0 Sales Value, which we identified as being the case due to a particular discount being used. So i want to do analysis with excluding all transactions whereby a single item has a 0 value. Thats the need for this flag.

 

Also, the database are coming from CSV Files. Currently that is exactly what i am doing, creating a lookup table with logic built in (corrrect keys to create merge) and then do a LEFT OUTER MERGE. 

 

However, it all works a tad slow which is why i am looking for altertive solutuons. This will make a lot more sense if you see the previous post which is in relation:

 

https://community.powerbi.com/t5/Desktop/Transformations-in-Power-Query-Very-Slow-Performance/m-p/58...

 

Thanks for your reply.

 

Laz

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.