Forum Discussion

PBIfanatic's avatar
PBIfanatic
Icon for Helper V rankHelper V
4 years ago

Selected Value not returning the value

Hi,

 

What seemed like a simple solution has taken few hours now and still cant figure out the SelectedValue issue. 

I have a Product table connected to a Promotions table with a relation 1 - many.

And have a filter for Promotion in the report. 

I need to create few calculated columns in the Product table using SelectedValue on the filter but I dont get the selected value of the filter. It just returns blank.  Is there any restriction on using the SelectedValue function, or is there a different way to use it? 

 

Product IDMeasure 1 
112
11122
111132

 

Product IDPromotion
11Promo1
11Promo2
11Promo3
111Promo1
111Promo4

 

6 Replies

  • PBIfanatic 

    If you are trying to create a calculated column then you cannot access what is selected in the report from any filter. This is because adding columns take place in the data modeling stage, once you complete that the data load and the model are ready for use in the report. 



    • PBIfanatic's avatar
      PBIfanatic
      Icon for Helper V rankHelper V

      thanks Fowmy 

      Is there a way to create a column on the fly based on the selected value from a filter?

       

      • Fowmy's avatar
        Fowmy
        Icon for Super User rankSuper User

        PBIfanatic 

        Yes, absolutely, you can use many table functions in DAX depending on your situation, for example

        FILTER (
            ADDCOLUMNS (
                VALUES ( 'Date'[Calendar Year] ),
                "@Amount",              [Sales Amount],
                "@Quantity Wrong",      SUM ( Sales[Quantity] )
             ),
            [@Amount] > SELECTEDVALUE( Parameter[Amount] )
        )



         

    • PBIfanatic's avatar
      PBIfanatic
      Icon for Helper V rankHelper V

      hi jdbuchanan71 

      if I had known this would have framed it differently. 

      I want to create a flag against each product based on some numerical values thats associated to the product(these values aer in other tables) for the Promotion filter selection.

       

       

       

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, PBIfanatic 

     

    What is your expected output?  Is it a slicer used?  What is the expected result of using the selectedvalue function?   Can you describe it or show it in pictures?  Look forward to your reply. Thank you.

     

    Best Regards,

    Community Support Team _Charlotte