cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

DAX snytax to replace measure values with another value

Hello,

 

I have a measure that calculates sum of sales. I want to be able to replace data from this measure, and use it to aid in projections. Currently the formula I have adds $3000 to every available line regardless of filters. Please see below the example of what I would like to happen.

 

Example Table Visual NOT Dax Table

Starting Table               
 Jan Feb Mar Apr May Jun Total  
Sales $           873,629.95  $  1,023,080.00  $  149,450.05  $  2,046,160.00  $   872,075.42  $  1,236,366.00  $  6,200,761.42  
                
Replace with               
   Feb            
Sales  3000            
                
End Result               
 Jan Feb Mar Apr May Jun    
Sales $           873,629.95 3000  $  149,450.05  $  2,046,160.00  $   872,075.42  $  1,236,366.00  $  5,180,681.42  
                
                
What if Parameter = $3000               
Current formula not working               
Calculate(sum(salestable[sales]))-(Calculate(sum(sales),Date[Month])+What if Parameter)               
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User VII
Super User VII

Re: DAX snytax to replace measure values with another value

@rtaylor that is what I was looking for, selected month

 

My Measure = 
IF ( SELECTEDVALUE ( Table[Month selected by user] ) = SELECTEDVALUE ( Datatable[Month] ), [What if parameter value], SUM ( Table[Amount] ) )

 

I would 💖 Kudos 🙂 if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

5 REPLIES 5
Highlighted
Super User VII
Super User VII

Re: DAX snytax to replace measure values with another value

@rtaylor what is the business logic to which month sales you want to replace with what-if parameter value, it is not clear from your post. In your example you did it for feb but why feb, why not another month?






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Highlighted
Helper III
Helper III

Re: DAX snytax to replace measure values with another value

Thanks @parry2k for responding.

Let's say I have table of financial projection data created by an analyst and this info is given to a director. The director now wants to see this same results but 3000 in sales february. Because a refresh would take too long. I would like to use
a what if parameter to replace the value.

 

February is just a random month. It could be any month. Also the syntax I wrote in my earlier example was just shorthand.

Highlighted
Super User VII
Super User VII

Re: DAX snytax to replace measure values with another value

@rtaylor it is not very clear, are we replacing all month values by what-if parameter or there is a logic which month with have what-if parameter. Does it make sense ?






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Highlighted
Helper III
Helper III

Re: DAX snytax to replace measure values with another value

@parry2k,

 

Okay I understand.

 

The end user should be able to select any month and replace that value with a what if parameter.

 

 

Below is what I have so far. I didn't want to post this because right now I'm focused replacing the value for one deminsion with a what if parameter.

 

Var yearselect1 = What_if_Year_End_Year_Select_1[What_if_Year_End_Year_Select_1 Value]
Var treatas1 = INTERSECT(values(ENTRY_Financial_Statement_Entry[Budget_Summary_Line]),values(W_Choice_Year_End_Choice_1[Budget_Summary_Line]))
Var treatasdate1 = TREATAS(values(W_Choice_Year_End_Month_Choice_1[MonthNameShort_FiscalYear]),'Date'[MonthNameShort_FiscalYear])
Var catamount1 = What_if_Year_End_Amout_1[What_if_Year_End_Amout_1 Value]*10000
Var calctreatas1 = calculate(ProjAmout,'Date'[FiscalYear] = yearselect1,treatas1,treatasdate1)* calculate(percenttotalcalc,treatas1,treatasdate1)
Var calctreatasnodate1 = calculate(ProjAmout,'Date'[FiscalYear]=yearselect1,treatas1)* calculate([Financial_Statment_Ratio],treatas1)

Return
(Financial_Projection_II]-calctreatas1)+(catamount1)

Highlighted
Super User VII
Super User VII

Re: DAX snytax to replace measure values with another value

@rtaylor that is what I was looking for, selected month

 

My Measure = 
IF ( SELECTEDVALUE ( Table[Month selected by user] ) = SELECTEDVALUE ( Datatable[Month] ), [What if parameter value], SUM ( Table[Amount] ) )

 

I would 💖 Kudos 🙂 if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors