Forum Discussion

SDPowerBI123's avatar
SDPowerBI123
Regular Visitor
2 years ago

Selectedvalue dax question

i have a simple what if parameter generating a list of numbers like this:

Numbers of Months = GENERATESERIES(3, 26, 1),
 
and then i have a selectedvalue dax measure that captures what is being selected like this:
Numbers of Months Value = SELECTEDVALUE('Numbers of Months'[Numbers of Months])
 
i put this measure in a card, and link the column to a slicer, when i selected lets say 15, the card with the measure inside says 15 no problem.
 
the problem is when i try to use this selectedvalue dax in another measure like this one:
Open X Months Prior =
var PriorDate = DATEADD('O 29 Years Monthly'[Date], -'Numbers of Months'[Numbers of Months Value], MONTH)
RETURN
CALCULATE(
    SUM('O 29 Years Monthly'[Open]),
    ALL('O 29 Years Monthly'),
    'O 29 Years Monthly'[Date] = PriorDate
)
 
so long story short i am trying to do some data analysis on some stock, and i try to discount the months back, i assume that measure would work in that second measure, but it just returns blank. can any one help me to understand why its returning blank when the card clearly says its returning a number? thanks.
 
i put link below.
 

3 Replies

  • Wilson_'s avatar
    Wilson_
    Memorable Member

    Hi SDPowerBI123,

     

    Can you please share a sample pbix file? (If you don't know how, please check the pinned thread in the forum.) It would make debugging your issue easier. 🙂

     

    There's at least some context missing on how and where you're using these measures, and probably what your model looks like (ie: tables and relationships).

      • Wilson_'s avatar
        Wilson_
        Memorable Member

        SDPowerBI123,

         

        The link tells me the file does not exist.