Forum Discussion
Calculated Columns and Measure
Hi,
I'm trying to create a measure that looks at columns Journey Alias and Stop Comp over 5 mins and returns either Compliant or Not Compliant for a specific Journey Alias.
Eg. 101191351 should be Not Compliant for all 3 rows, how am I able to make this?
Thanks
Hi Anonymous ,
You could try the following measure:
test =
VAR not_compliant =
CALCULATE (
COUNT ( 'Table'[Stop Comp over 5 mins] ),
FILTER (
ALL ( 'Table' ),
'Table'[Journey Alias] = MAX ( 'Table'[Journey Alias] )
&& 'Table'[Stop Comp over 5 mins] = "Not Compliant"
)
)
VAR at_all =
IF ( not_compliant >= 1, "Not Compliant", "Compliant" )
RETURN
at_allFinally you will see:
If this is not what you want, please describe what you want, thank you!
Best Regards,
Lucien
14 Replies
- amitchandakSuper User
Anonymous , Try a measure like
if(isblank(calcuate(countx(filter(Table, containsstring(Table[Stop over 5 Min], "Not Complaint")),Table[Journey Alias]), allexcept(Table, Table[Journey Alias]))),"Complaint","Not Complaint")
- AnonymousNot applicable
this measure seems to inflate the number of actual rows in the table, there's only meant to be 40 rows and this just keeps going when I scroll down and all rows turn into Not Compliant, unless I filter the Journey Aliases one by one then the measure works
- amitchandakSuper User
Anonymous ,
Try this one
if(isblank(calculate(countx(filter(Table, containsstring(Table[Stop over 5 Min], "Not Complaint")),Table[Journey Alias]), filter(allselected(Table), Table[Journey Alias] =max(Table[Journey Alias])))),"Complaint","Not Complaint")
- amitchandakSuper User
Anonymous , Try this one
if(isblank(calculate(countx(filter(Table, containsstring(Table[Stop over 5 Min], "Not Complaint")),Table[Journey Alias]), filter(allselected(Table), Table[Journey Alias] =max(Table[Journey Alias])))),"Complaint","Not Complaint")
- Ashish_MathurSuper User
Hi,
I think the ALLEXCEPT() function should work. I can offer more help if you share the link from where i can download your PBI file.
- AnonymousNot applicable
here's the link, let me know if that works
- Ashish_MathurSuper User
That is not a file download link.
- AnonymousNot applicable
Hi,
I'm not sure how to do this actually since I've never shared a powerbi file to an external user. I've published it in my workspace and clicked share there but it asks for an email address and the only link available was the report link at the bottom which I have already sent here.
If you can direct me on how to do this then I'll be able to do so since I can't find a solution for this on here.
- v-luwang-msftCommunity Support
Hi Anonymous ,
You could try the following measure:
test =
VAR not_compliant =
CALCULATE (
COUNT ( 'Table'[Stop Comp over 5 mins] ),
FILTER (
ALL ( 'Table' ),
'Table'[Journey Alias] = MAX ( 'Table'[Journey Alias] )
&& 'Table'[Stop Comp over 5 mins] = "Not Compliant"
)
)
VAR at_all =
IF ( not_compliant >= 1, "Not Compliant", "Compliant" )
RETURN
at_allFinally you will see:
If this is not what you want, please describe what you want, thank you!
Best Regards,
Lucien
- AnonymousNot applicable
This doesn't work either, if you can help me share the file link then that would help as having the underlying data will help make my question easier to understand.
- v-luwang-msftCommunity Support
- v-luwang-msftCommunity Support
Hi Anonymous ,
Has your problem been solved, if so, please consider Accept a correct reply as the solution to help others find it.Best Regard
Lucien Wang