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.
Hi,
I have a table like the below:
There are some companies on the table and each one sells different products. As can be seen, in the table, if the product code is glasses or shipping or additional item, the plan frequency column is monthly; otherwise is yearly. I want to create a new plan frequency modified column in a way that if a car or pen or pencil exists for that company, all the plan frequencies for that company change to yearly. The new desired common is also shown.
Company Name | Plan frequency | Productcode |
A | Monthly | glasses |
A | Monthly | shipping |
A | Yearly | car |
A | Yearly | pen |
B | Monthly | glasses |
B | Yearly | pen |
B | Yearly | pencil |
B | Yearly | bottle |
C | Monthly | glasses |
C | Monthly | shipping |
C | Yearly | car |
C | Yearly | pen |
C | Monthly | additional item |
CalculatedColumn=VAR _c=Data[Company Name] RETURN IF(COUNTROWS(FILTER(Data,Data[Company Name]=_c&&Data[Productcode] IN {"car","pen","pencil"})),"Yearly",Data[Plan frequency])
Hi, @ArashZ
If @wdx223_Daniel 's formula doesn't work, can you show relevant screenshots to further investigate what's causing the error?
Also, check if the bias in the results is caused by errors in the data itself.
Best Regards,
Community Support Team _ Eason
Hi @ArashZ
I think this is what you are looking for...
Plan Frequency Modified =
var _isinlist = CALCULATE(COUNT('Table'[Productcode]),CONTAINSROW({"car","pen","pencil"},'Table'[Productcode]),FILTER(ALLEXCEPT('Table','Table'[Company Name]),'Table'[Company Name] = EARLIER('Table'[Company Name])))
return
if(_isinlist >=1,"Yearly", "Monthly")
Hope this helps!
Thanks,
AnthonyJoseph
Thanks, but I received this error.
A single value for the column company name in the table cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation to get a single result.
Hi @ArashZ
Would you be able to share the DAX that you tried so that I can see if there are any syntatical errors.
Thanks,
AnthonyJoseph
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 |
---|---|
47 | |
24 | |
20 | |
15 | |
12 |
User | Count |
---|---|
55 | |
48 | |
43 | |
19 | |
18 |