1

I have written a DAX which is supposed to mark a 1 in the cell if the Organisation has been with multiple (distinct) sectors, however, I keep running into some issues.

Dup = 
CALCULATE( 
    COUNT('Inspection Scheduling Spreadsheet'[Licensed Establishment / Organisation]),
    FILTER(
        VALUES ('Inspection Scheduling Spreadsheet'[Licensed Establishment / Organisation] ),
        DISTINCTCOUNT( 'Inspection Scheduling Spreadsheet'[Sector]) > 1 
    )
) 

The column Dup should be returning 0 because the organisation has been with the same sector.

Whereas, this is when Dup should return a 1 enter image description here So whenever an organisation has been with more than one sector the column Dup should return a 1 else 0

1 Answer 1

1

Try this below code-

Dup =

VAR current_row_org = MIN('Inspection Scheduling Spreadsheet'[Licensed Establishment / Organisation])

VAR dist_count =  
CALCULATE( 
    DISTINCTCOUNT('Inspection Scheduling Spreadsheet'[Sector]),
    FILTER(
        ALL('Inspection Scheduling Spreadsheet'),
        'Inspection Scheduling Spreadsheet'[Licensed Establishment / Organisation] = current_row_org
    )
)

RETURN IF(dist_count > 1,1,0)

Sign up to request clarification or add additional context in comments.

4 Comments

I tested the above code and everything just returns 0
This should work. Did you changed any part in the code? If so, please share the new Measure code here.
I just created a custom column and placed the entire code inside and it returns 0 for every organisation
In case of custom column, just create the first variable as - VAR current_row_org = 'Inspection Scheduling Spreadsheet'[Licensed Establishment / Organisation]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.