Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi Team,
I need your help in writing a dax formula to get the result from table on the right hand side.
The Current table has a list of columns such as Date, No. of Shares, Close Price and Amount. The Amount column is calculated when we multiply No. of Shares and Close Price.
To get the result from the Desired Result table,
I have a Filter Option in the Power BI Report to filter out the Date.
I would like to create a DAX Formula in Power BI which helps me to Select the Date from the Date Filter which would return the dates until the selected date and takes in consideration the Close Price of the selected date and applies the same close price for the previous dates and use that close price to multiply the no. of shares to get the results in Amount column.
I.e.,
Formula = When clicked on the Selected Date = Apply Close Price of selected Date for the previous Dates * No. of Shares
In this case,
I have Selected the date to be 25/01/2021, where the close price is 16 and it applies to the previous dates as well to multiply the no. of shares to get the Amount as a result.
Thanks
Ankush
Solved! Go to Solution.
@ankush-vem , Try a measure like
measure =
var _max = maxx(allselected('Date') ,[Date])
var _price = calculate(Max(Table[price]), filter(allselected(Table), Table[Date] = _max))
return
sumx(Table, Table[No of shares] * _price )
@ankush-vem , Try a measure like
measure =
var _max = maxx(allselected('Date') ,[Date])
var _price = calculate(Max(Table[price]), filter(allselected(Table), Table[Date] = _max))
return
sumx(Table, Table[No of shares] * _price )
Hi Amitchandak,
Thank you for your reply and it retuns a value but no way of seeing its correct or wrong. Can we split this messure into two? one for the selected date's close price and then we can multiply it by the no of shares?
Also can you advise on how we can filter the ledger records on and before the selected date.
Thank you,
Uthpala
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 71 | |
| 66 | |
| 33 | |
| 32 | |
| 32 |