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.
Dear community,
I have a dataset with a column that contains different types of transactions. I only need to calculate with values that contain WO, TO, SO or IC. I tried to solve it with a if and contain function but that didn't work. I've now solved it by creating a calculated column for each type but I think there should be an easier way in DAX. This is my calculated column now:
Hi @DLU ,
Has the problem be solved?
Please consider to mark the reply as solution if it's helpful.
No unfortunately my problem wasn't solved. I've now solved it by adjusting my SQL query and already filtering that, so I can't accept any responses with the solution
@DLU ,
Appears to me, you want to make use of the IN function in DAX. So something like this:
Number of Transactions = CALCULATE( SUM( Inventory[QTY]),
FILTER(Inventory, Inventory[ReferenceID] IN { "WO", "TO", "SO", "IC" } ))
Not sure if you need to use SUM or SUMX depending on your specific purpose.
Hope this gives you some ideas to simplify your DAX.
Regards,
Dear rsbin,
I've tried and I'm not getting an error but I'm not getting any data either. Just for your information. The referenceID is never only WO or SO etc. The WO is part of a bigger number like WO-001 or TXN-WO001. Could that now be the problem?
Regards, Diana
@DLU ,
Yes, that is the problem. Based on your description, I assumed the Column value was simply the 2 character code. I would suggest you create another Calculated Column isolating the codes you are searching for. There are a number of DAX Text functions similar to those in Excel that can be used to extract these codes from the bigger number.
https://learn.microsoft.com/en-us/dax/text-functions-dax
Hope you are able to carry forward. If not, please post sample data as a table (not an image) and I will try to find some time to assist.
Regards,
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
85 | |
77 | |
66 |
User | Count |
---|---|
120 | |
112 | |
94 | |
84 | |
75 |