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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Please help me with this dax forumle

Hello guys I need these  calculation to work for a card visual to display the value of sum auditfile

CALCULATE(SUM('2 (Auditfile)'[saldo]), IF(VALUES('2 (Auditfile)'[fiscalYear])>2018,[fiscalyear]-1))
 
why doesnt it work i want the value of sum saldo  
many thanks :):):)
1 ACCEPTED SOLUTION

Hi @Anonymous 

you can manually insert a single column table that contains the years. Let's call it 'YearFilter' which will be completely disconnected from any other table in your data model. This table will be used as a slicer and the measure would be

SumMeaaure =
VAR CurrentYear =
    SELECTEDVALUE ( 'YearFilter'[Year] )
RETURN
    CALCULATE (
        SUM ( '2 (Auditfile)'[saldo] ),
        '2 (Auditfile)'[fiscalYear] >= CurrentYear - 1
    )

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hello why not use previous year? 

Calculate(sum(tabble[value]),previousyear([date]))

Anonymous
Not applicable

becasue that doesnt work for me the way my data is build :(:(:( it would be the  easy way i know but i have the bad luck i have to fix a working repot :S

Anonymous
Not applicable

Hmm well when you select a slicer the range becomes only for the slicer so try the removefilters function? 

 

CALCULATE(SUM('2 (Auditfile)'[saldo]), IF(VALUES('2 (Auditfile)'[fiscalYear])>2018,[fiscalyear]-1),removefilters(dateyouuseforslicer))

Anonymous
Not applicable

if i use your formule i get this error Schermafbeelding 2022-10-21 130939.png

tamerj1
Super User
Super User

Hi @Anonymous 

would you please explain what are you trying to achieve by the IF statement in your DAX code?

Anonymous
Not applicable

Hey tamerj1

i'm trying to archieve a calculation in a card visual, if i select 2019 in a slicer i want the sum of saldo from 2018
if i select 2020 in a slicer i want the sum of saldo from 2019 and so on

i know the if statement works for -1 on the year

Hi @Anonymous 

you can manually insert a single column table that contains the years. Let's call it 'YearFilter' which will be completely disconnected from any other table in your data model. This table will be used as a slicer and the measure would be

SumMeaaure =
VAR CurrentYear =
    SELECTEDVALUE ( 'YearFilter'[Year] )
RETURN
    CALCULATE (
        SUM ( '2 (Auditfile)'[saldo] ),
        '2 (Auditfile)'[fiscalYear] >= CurrentYear - 1
    )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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