Forum Discussion
InsightSeeker
2 years agoHelper III
Need help with DAX formula
I need help to achieve the results shown in the table below. Essentially, in the 'Category' column, if all the values are the same, then return the first value; otherwise, return 'Mix...
- 2 years ago
Hi,
This calculated column formula works
Column = if(SUBSTITUTE(SUBSTITUTE(Data[Category],"-",BLANK()),LEFT(Data[Category],SEARCH("-",Data[Category],,20)-1),BLANK())="",LEFT(Data[Category],SEARCH("-",Data[Category],,20)-1),"Mix")Hope this helps.
InsightSeeker
2 years agoHelper III
Hi Anonymous - yes i do have some cells which does not have any values, how can i handle this?
Anonymous
2 years agoNot applicable
InsightSeeker Can you show how those data looks like?
I made a test with blank and "-" in cells but the previous formula works for both. Those rows display blank in the column without any error.
I did some more test and found that the error you met is probably caused by the len argument in GENERATESERIES function. If it is blank, the error happens. So please check whether len returns correct values for all rows. You can modify the formula to return len to check the result. For example, in my below test, it should return a number on every row rather than blank.