Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I want to make calculations Current year*,that ignore my filter selections
*Current Year calculation is sum of amount of Max of Current year in AP_Database table
here are my scheme :
Date.Clearing one to many AP_Database.Clearing
but it seems doesn't work.
When i filtered table Date, it also filtered the Current Year New
Solved! Go to Solution.
Hi @adityo ,
It is because you are using ALL() function in the formula. Try using ALLEXCEPT() function instead.
measure 1 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALLEXCEPT(AP_Database,AP_Database[category]), YEAR(AP_Database[Clearing])=MaxYear))
measure 2 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL(AP_Database), YEAR(AP_Database[Clearing])=MaxYear&&AP_Database[category]=SELECTEDVALUE(AP_Database[category])))
If both the above measures don't work, please show some sample data and expected result to us.
Best Regards,
Jay
Hi @adityo
Im aorey but this is one of the worst advice I saw on this forum.
For god sake, dont use filter( All(Ap_database)). What if this table has million rows, you will end up iterating on all the rows.
The approach from @amitchandak is really better in this case.
@v-jayw-msft it seems work.... it calculates the current year. but i think it will mislead the context. while im using matrix for the visualization, all the number are same for all category....
Hi @adityo ,
It is because you are using ALL() function in the formula. Try using ALLEXCEPT() function instead.
measure 1 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALLEXCEPT(AP_Database,AP_Database[category]), YEAR(AP_Database[Clearing])=MaxYear))
measure 2 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL(AP_Database), YEAR(AP_Database[Clearing])=MaxYear&&AP_Database[category]=SELECTEDVALUE(AP_Database[category])))
If both the above measures don't work, please show some sample data and expected result to us.
Best Regards,
Jay
@adityo , Try one of the two
Current Year New =
var MaxYear = year(today())
RETURN
CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL('Date'[Year Outgoing]), 'Date'[Year Outgoing]=MaxYear))
Current Year New =
var MaxYear = maxx(all('Date'), 'Date'[Year Outgoing])
RETURN
CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL('Date'[Year Outgoing]), 'Date'[Year Outgoing]=MaxYear))
@amitchandak thank you for your response, unfortunately both of them doesn't works. the DAX script doesn't return error. but it keep filtered.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |