Reply
Mjolnir
Helper I
Helper I

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
1 ACCEPTED SOLUTION

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

    )

)


View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Mjolnir You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

 

Also:



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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

    )

)


avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)