Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

retrieve the value entered/chosen by a user for calculations

In Power BI, I want to give the possibility to the user to enter a date. after much research, the solution I found is to allow the user to choose and not to enter a date. Then I want to retrieve the chosen value in a variable and do the following calculation: For each value in column var2, run var2-datechoose and convert the result to days. the results should be stored in a variable which I will use to build a graph.

The problem is despite all my attempts, nothing worked.

Find below my code:

-- try1

Mesurevar= IF(ISBLANK('Table'[var1]), DATEDIFF('Table'[var2],SELECTEDVALUE(DateToChoose[Date], 1), DAY), BLANK())

Selected Date = SELECTEDVALUE(DateToChoose[Date])

Mesurevar= IF(ISBLANK('Table'[var1]), DATEDIFF('Table'[var2], DATEVALUE([Selected Date]), DAY), BLANK())


Mesurevar =
var Selected_Date = SELECTEDVALUE(DateToChoose[Date])
IF(ISBLANK('Table'[var1]), ('Table'[var2] - DATEVALUE(Selected_Date)), BLANK())


I bound the Date variable from the DateToChoose table to the var2 variable from the Table table.

I would appreciate any help.

Super User
Super User

the results should be stored in a variable which I will use to build a graph.

That's not something you can do in Power BI.  Either you create a static calculated column or table, or you create a (dynamic) measure.   Variables can be used during the creation of either but they cannot be "stored" anywhere.

Helpful resources


Fabric certifications survey

Certification feedback opportunity for the community.


Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.