- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

DAX measure with dynamic input
I am afraid the answer to this question is not but I'll try.
Is it possible to create a measure with a dynanic input from other measures?
For example:
function doubleIt(number){
return number*2
}
function mySalesDoubled(){
var mySales = Table[amount]
var doubleSales = doubleIt(mySales)
return doubleSales
}
So I make two measures, one is doubleIt and another is mySalesDoubled
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @fabiomanniti .
If you want to have a dynamic value then why not directly write down the value rather than writing down the measure.
For example, IF([Measure]=100, "A","B")
Let me know if I have answered your question.
If yes, then kindly mark it as "Accept as Solution" and give it a thumbs up.
THanks,
Sanket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Well, but this is not very helpful because my main problem is that sometimes I have to write multiple times the same measure with just one variable as difference and I would like to write part of code as an external measure instead of copying it everytime.
I make an example:
I want to know the percentage of users I had one month ago, three months ago, six months ago, up to one year ago.
Then I want to put these four values into a table and see all the results.
In order to obtain this I write the same measure four times and anytime I change the number of months I must subtract from today's date.
It would be helpful if I could use an external measure where I insert the number of months and I obtain the date of those number of months ago.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @fabiomanniti ,
You can refer the following links to get it.
Try this measure
=calculate([qty_sales],datesbetween(calendario[date_key],EOMONTH(MAXX(ALL(calendario),calendario[date_key]),-6)+1),MAX(calendario[date_key])))
To your visual, drag Year and Month from the calendario table. Ensure the actual date columns of your data table and calendario table are related.
Calculate the values of the 1, 3 and 6 months prior to the current one
assuming you have date table and marked as date, you can use following measure to calculation L12 month and change this measure for 3 and 6 months
Last 12 Months = VAR __lastMonthDate = EOMONTH ( TODAY(), -1 ) VAR __numberofMonth = 12 RETURN CALCULATE ( SUM ( Table[Sales] ) , DATESINPERIOD ( Calendar[Date], __lastMonthDate, -__numberofMonth, MONTH ) )
Best Regards
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

This was exactly what I had been searching for - I was needing to filter results 'on the fly' depending upon a user-selected week ending date. I ended up using DATESBETWEEN for the clustered column field and a different range of DATESBETWEEN for the associated line chart.

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
06-18-2024 12:55 PM | |||
06-19-2024 08:36 AM | |||
08-12-2024 12:49 PM | |||
05-14-2024 09:39 AM | |||
08-30-2024 07:31 AM |
User | Count |
---|---|
134 | |
105 | |
87 | |
55 | |
46 |