The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello guys I need these calculation to work for a card visual to display the value of sum auditfile
Solved! Go to 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
)
Hello why not use previous year?
Calculate(sum(tabble[value]),previousyear([date]))
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
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))
if i use your formule i get this error
Hi @Anonymous
would you please explain what are you trying to achieve by the IF statement in your DAX code?
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
)
User | Count |
---|---|
13 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
13 | |
8 | |
8 |