Forum Discussion

SarahESkells's avatar
SarahESkells
Helper I
3 years ago

Identifying a max value in a large data set

Hi

 

I have a data table with a list of tasks and clients - each task has an outcome and a client can have more than one of the same task allocated to them - I want to produce a table where it counts each client only once and allocates them to the highest ranking outcome.

 

As an example

Client NameTaskTask OutcomeOutcome Rank
Joe Bloggs (123)Task AMeeting5
Joe Bloggs (123)Task ANo Response1
Jane Doe (456)Task AFollow Up3
Jane Doe (456)Task ANo Response1
John Smith (789)Task AMeeting5

 

I would want the table I'm showing to reflect this, so Jane is counted as a follow up and Joe and John are counted as meetings, no one is counted as No Response

OutcomeClients
Meeting2
Follow Up1
No Response0

 

Thank you in advance

 

1 Reply

  • If you have the outcomes in a dimension table linked to the main fact table then you can use

    Clients per outcome = 
    VAR SummaryTable = ADDCOLUMNS(
    	ALL( 'Fact Table'[Client Name]),
    	"@best task", CALCULATE( MAX( 'Fact Table'[Outcome Rank]))
    )
    RETURN COUNTROWS( FILTER( SummaryTable, [@best task] IN VALUES( 'Dim Task'[Outcome Rank])))

    Please see the attached PBIX