Skip to main content

Hello, I am having trouble with the calculation below where qty/value is an aggregation and the PI fields are just decimal values.

 

zn(IF MIN(DATE([Date]) = DATE(#January 1,2023#)) 

then [Qty/Value] * [Jan PI]

ELSEIF MIN(DATE([Date]) = DATE(⌗February 1,2023#))

then [Qty/Value] * [Feb PI ]

END

 

I'm expecting to see the value but the above flow just returns results of 0 for all rows, any advice would be appreciated.

 

Thank you

3 respostas
  1. 10 de ago. de 2023, 14:46

    @Mason Hughes​ 

    Hi, in this case I would use something like:

    SUM(IF DATE([Date])=#2023-01-01# THEN [Qty]*[Jan PI]

    ELSEIF DATE([Date])=#2023-02-01# THEN [Qty]*[Feb PI]

    ELSE 0

    END)/

    SUM(IF DATE([Date])=#2023-01-01# THEN [Value]

    ELSEIF DATE([Date])=#2023-02-01# THEN [Value]

    ELSE 0

    END)

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000