Forum Discussion

ellengrace2293's avatar
ellengrace2293
Frequent Visitor
8 years ago
Solved

Using a Max value in a IF statement for graph

Hello! Let's say I have a query with the following columns: [Date], [ID], [Flow], and [Overflow]. I need to have another column (or measure) that mostly equals the [Flow] value, except when [Flow] fo...
  • Anonymous's avatar
    Anonymous
    8 years ago

    This calculated column is what you were trying to write 

    calculated column = 
    var currentID = [ID]
    var maxFlow = CALCULATE(
    	MAX('Flow Data'[Flow]),
    	ALL('Flow Data'),
    	'Flow Data'[ID] = currentID
    )
    RETURN
    IF(
    	AND(
    		[Flow] = maxFlow,
    		[Overflow] > [Flow]
    	)
    	[Overflow], 
    	[Flow]
    )