Forum Discussion

Mjolnir's avatar
Mjolnir
Icon for Helper I rankHelper I
2 years ago
Solved

Not working: sum based on selected slicer values and additional criterias

Hi,
 
Want to create a measure to sum previous year's values. Previous year should be equal to selected year in slicer subtracted by 1. Years, months and days are numbers formatted as text in my data-sets; 2023... 01... 31... Tried the expression below but it is returning error. If slicer= 2023, then this measure should generate all values for 2022. Appreciate all help on this, thanks.
 
measure_SumPreviousYear = 
CALCULATE(
SUM(facts_general_ledger[values]),
SELECTEDVALUE(dim_calendar[year])-1)
 
Returning error: The True/False expression does not specify a column. Each True/False expressions used as a table filter express must refer to exactly one column
  • Mjolnir's avatar
    Mjolnir
    2 years ago

    Thanks for your response mate.

     

    The following DAX solved the issue:

    CALCULATE(

        SUM(facts_general_ledger[values]]),

        FILTER(

            ALL(dim_calendar),

            VALUE(dim_calendar[year]=SELECTEDVALUE(dim_calendar[year])-1

        )

    )


2 Replies