Forum Discussion

Ortignano's avatar
Ortignano
Helper II
5 years ago
Solved

Debugging measure (How refer to columns of a table variable)

Hi all,

I'm in trouble to a standard deviation calculation (last 12 months) as my measure give me a results different from excel, so I would debug the formula.

The formula start with 

STD:=

VAR LastMonthID =
MAX ( 'Calendar'[MonthID] )
VAR FirstMonthID = LastMonthID - 11
VAR Months =
FILTER (
ALL ( 'Calendar'[MonthID] );
'Calendar'[MonthID] >= FirstMonthID
&& 'Calendar'[MonthID] <= LastMonthID
)

VAR MOnthlyQty =
ADDCOLUMNS ( Months; "Qty"; [Total_Case] +0)

FirstMonthID and LastMOnth ID works well but I'm not able to refer to column Qty to check if it's all correct.

Do you have any suggestion?

 

Thanks in advance

Antonio

  • You could use CONCATENATEX to see a list of each of the [Qty].

     

    STD :=
    VAR LastMonthID =
        MAX ( 'Calendar'[MonthID] )
    VAR FirstMonthID = LastMonthID - 11
    VAR Months =
        FILTER (
            ALL ( 'Calendar'[MonthID] );
            'Calendar'[MonthID] >= FirstMonthID
                && 'Calendar'[MonthID] <= LastMonthID
        )
    VAR MOnthlyQty =
        ADDCOLUMNS ( Months; "Qty"; [Total_Case] + 0 )
    RETURN
        CONCATENATEX ( MOnthlyQty; [Qty]; "," )

2 Replies

  • You could use CONCATENATEX to see a list of each of the [Qty].

     

    STD :=
    VAR LastMonthID =
        MAX ( 'Calendar'[MonthID] )
    VAR FirstMonthID = LastMonthID - 11
    VAR Months =
        FILTER (
            ALL ( 'Calendar'[MonthID] );
            'Calendar'[MonthID] >= FirstMonthID
                && 'Calendar'[MonthID] <= LastMonthID
        )
    VAR MOnthlyQty =
        ADDCOLUMNS ( Months; "Qty"; [Total_Case] + 0 )
    RETURN
        CONCATENATEX ( MOnthlyQty; [Qty]; "," )