Selectedvalue not working

Having a night of it tonight, i can’t get selectedvalue to work in my following dax calc, i have the budget name column in a slicer and i have selected the correct budget name, I have confirmed this with a seperate card just to make sure but when i try to apply selectedvalue to my Dax it returns blank values, but when i type the value in “FY21Bud” then it works?!?!? I had to remove all the filters as i needed to sum by the parent roll up grouping numbers and not the actual account number so i am tryin to re-apply the filters but for the life of me i can’t get it to work unless i type the value, any ideas?

GL OHead Budget =
VAR COAName = SELECTEDVALUE(COA[Name])
VAR BudName = SELECTEDVALUE(Consol_GLBudget[Budget Name])
Var Calc =
CALCULATE([GL Bud Amount],
FILTER(all(
Consol_GLBudget),
Consol_GLBudget[Acc. Rollup Number] = SELECTEDVALUE(COA[Acc Rollup Number])),
KEEPFILTERS(VALUES(Dates[Month & Year])),
Consol_GLBudget[Budget Name] = BudName) //This does not work if i use selectedvalue but i have checked via a seperate card that the budget selected is the correct one

VAR TblTotal = CALCULATE([GL Bud Amount],
FILTER(all(
Consol_GLBudget),
Consol_GLBudget[GL Number] >= 70000000 && Consol_GLBudget[GL Number] < 78000000),
KEEPFILTERS(VALUES(Dates[Month & Year])),
KEEPFILTERS(Consol_GLBudget[Budget Name] = “FY21Bud”))*-1 //This works if i type the result

    Return

IF(HASONEVALUE(COA[Name]),calc, TblTotal)

Hi @BCS. Please upload your work-in-progress PBIX and a marked-up screenshot of the visual in question showing your desired outcome fro the forum members to review.
Greg

Hi @BCS, adding up to what @Greg mentioned above, we aim to consistently improve the topics being posted on the forum to help you in getting a strong solution faster.

Please make sure to:

  • When posting a topic with formula make sure that it is correctly formatted to preformatted text </>.

image

  • Include the masked demo pbix file,.

I also suggest that you check the forum guideline How To Use The Enterprise DNA Support Forum. Not adhering to it may sometimes cause delay in getting an answer.

Please also check the How To Mask Sensitive Data thread for some tips on how to mask your pbix file.

Hi @BCS, we’ve noticed that no response has been received from you since the 12th of May. We are waiting for the masked demo pbix file.

In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

@BCS,

In debugging issues related to SELECTEDVALUE, I’ve found the second optional parameter in that function to be invaluable.

Thus, I would try setting up your variables like this

VAR COAName = SELECTEDVALUE(COA[Name], “Error 001”)
VAR BudName = SELECTEDVALUE(Consol_GLBudget[Budget Name], “Error 002”)

This will help you determine which condition is failing to narrow to a single value.

I hope this is helpful.

  • Brian

Hi @BCS, did the response provided by @BrianJ help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark as solution the answer that solved your query.

Thanks Brian :+1:

1 Like