Latest Enterprise DNA Initiatives

Allselected+values+sumx can't be combined

Hi all,

I’m having difficulty calculating the year month count in a filtered period with the additional check that a measure is not blank in that period.
This is the logic that I approached my calculation but for some reason that returns
all selected expects a table reference for argument ‘1’, but a table expression was used

iMonthCount =
    SUMX (
        ALLSELECTED ( VALUES ( tMasterCalendar[YearMonth] ) );
        IF ( NOT ( ISBLANK ( [IN] ) ); 1; 0 )

2 Questions:
1.Why it doesn’t work?
2.How would you approach it?

Hi @giomil,

You’ll need to choose so either ALLSELECTED ( tMasterCalendar, tMasterCalendar[YearMonth] ) or VALUES ( tMasterCalendar[YearMonth] )

It doesn’t work because ALLSELECTED needs a Table and then a Column reference whereas VALUES returns a Single column Table. Here you’ll find more on ALLSELECTED and here’s more on VALUES

I hope this is helpful.

Hi @giomil, a response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Thanks!