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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Use slicer value to multiply

Hi,

 

I use a CALENDAR function to create a calendar from the last date in my table and 365 days into the future, based on this formula:

 
FutureAUM = CALENDAR(LASTDATE(Holdings[AsOfDate]),LASTDATE(Holdings[AsOfDate])+365)
 
What I want is for the users to be able to use a slicer drop down to select how many years the 365 days should be multiplied with. For example, if the user selects 2 years from the drop down menu, the formula should look like this:
 
FutureAUM = CALENDAR(LASTDATE(Holdings[AsOfDate]),LASTDATE(Holdings[AsOfDate])+(365 * 2))
 
It all works with the 365, but I'm not able to make it work with (365 * User input).

 

Any recommendations?

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use SELECTEDVALUE() function.

Create a table with columns contains values (1,2,3,4,5,...) adn use this column as dropdown slicer.

Modify your formula as below.

FutureAUM = CALENDAR(LASTDATE(Holdings[AsOfDate]),LASTDATE(Holdings[AsOfDate])+365*SELECTEDVALUE('slicer'[slicer]))

 

Best Regards,

Jay 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

8 REPLIES 8
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use SELECTEDVALUE() function.

Create a table with columns contains values (1,2,3,4,5,...) adn use this column as dropdown slicer.

Modify your formula as below.

FutureAUM = CALENDAR(LASTDATE(Holdings[AsOfDate]),LASTDATE(Holdings[AsOfDate])+365*SELECTEDVALUE('slicer'[slicer]))

 

Best Regards,

Jay 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , if you are creating a table. I doubt you can use slicer parameters

FrankAT
Community Champion
Community Champion

Hi @Anonymous 

create a new parmeter on tab Modeling. Power BI Desktop creates a new table with measure to use as multiplier. Insert this measure into your DAX formula.

 

15-09-_2020_15-10-49.png

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Anonymous
Not applicable

Hi @FrankAT,

 

Thanks for the reply! 

 

Like this? 

FutureAUM = CALENDAR(LASTDATE(Holdings[AsOfDate]),LASTDATE(Holdings[AsOfDate])+(365*nYears[nYears Value]))
 
 
 
I chose the slicer to be 2 in this case. If I do it like that, the graph dissapears. However, if I use 
FutureAUM = CALENDAR(LASTDATE(Holdings[AsOfDate]),LASTDATE(Holdings[AsOfDate])+(365*2)), the graph expands to two years.

 

 

 

Hi @Anonymous 

use the automatic created measure not the table column!

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Anonymous
Not applicable

hi @FrankAT ,

 

I belive that is what I'm trying to do:

 

measure.PNG

 

 

 

 

 

The calculator indicates that it is the measure, right?

Hi @Anonymous 

see figure:

 

15-09-_2020_15-49-24.png

 

Use the measure (in this example) Multiply by Value in your DAX formula as the multiplier.

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Anonymous
Not applicable

@FrankAT  Thanks!

 

My formula now looks like this: 

FutureAUM = CALENDAR(LASTDATE(Holdings[AsOfDate]),LASTDATE(Holdings[AsOfDate])+(365* SELECTEDVALUE('nYears'[nYears],3))
 
So, the problem now is that it uses 3 years, becuase of the [AlternateResult] = 3, and it does not change if I change the input in the parameter... Any clues?
 
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

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.