Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Mjolnir
Frequent Visitor

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:


@ 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!:
The Definitive Guide to Power Query (M)

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

    )

)


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors