Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi ALL,
I wrote a calculation about a slicer with a selected value function. Return false if something is selected , return True is something unselected.
her is my calculation
MTD TO =
var MonthTest = SELECTEDVALUE(DistributorTarget[Month])
var calc =IF(ISBLANK(Monthtest)=FALSE(), CALCULATE(SUM(DistributorTarget[ActualValue])),
CALCULATE(SUM(DistributorTarget[ActualValue]),FILTER('Date','Date'[ThisMonthMTD] = 1),FILTER(DistributorTarget,Convert(DistributorTarget[Year],INTEGER)=YEAR(TODAY()))))
return calc
here is my true/false test example
A_Test_False/True =
var MonthTest = SELECTEDVALUE(DistributorTarget[Month])
var calc = IF(ISBLANK(MonthTest)=FALSE(),"false",
"true")
return calc
when I selected One month or selected all, it works. But when I selected more than one month it return true and it is like behavior for all months selected. I just want to calculate it selected month's amount
How can I solve this issue?
Best regards
Sinan
Solved! Go to Solution.
Hi @sinanalmac ,
Please be aware of that selectedvalue() function will return blank if there are multiple values selected.
In this case you could use COUNTROWS(VALUES(<columnName>)) = 1 or HASONEVALUE() function instead.
Best Regards,
Jay
Hi @sinanalmac ,
Please be aware of that selectedvalue() function will return blank if there are multiple values selected.
In this case you could use COUNTROWS(VALUES(<columnName>)) = 1 or HASONEVALUE() function instead.
Best Regards,
Jay
what amitchandak said, but just to add a little info:
selectedvalue ONLY returns a value when there is ONLY ONE selected... thats why the results are correct!
@sinanalmac , You can use hasonevalue and isfiltered - https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/
Or you can check
countrows(allselected(Table[Month] )) >1
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
92 | |
83 | |
71 | |
49 |
User | Count |
---|---|
143 | |
120 | |
110 | |
59 | |
57 |