March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Good Morning All,
I've searched around the web but found no solution. My problem maybe is simple but, I've no idea how to solve it.
For each row in this dataset, I need to calculate the formula B/D*C and when the value of D column is Blank I want to use the last value until the new one arrives, as shown in the screenshot.
Thanks in advance
Solved! Go to Solution.
@vetty if you want to create this column in the model itslef in DAX, create this calculated column and use it for your calculations:
D Filled =
VAR _currrentdate = 'Table'[A]
RETURN
CALCULATE(
LASTNONBLANKVALUE(
'Table'[A],
CALCULATE(SUM('Table'[D]))
),
REMOVEFILTERS(),
'Table'[A] <= _currrentdate
)
@vetty if you want to create this column in the model itslef in DAX, create this calculated column and use it for your calculations:
D Filled =
VAR _currrentdate = 'Table'[A]
RETURN
CALCULATE(
LASTNONBLANKVALUE(
'Table'[A],
CALCULATE(SUM('Table'[D]))
),
REMOVEFILTERS(),
'Table'[A] <= _currrentdate
)
Thank you @SpartaBI it was what I'm trying to do. Also the solution from @amitchandak works very well. Both solutions works also when the dataset refresh, so I'm pretty curious about which has the best performance. I think that @amitchandak solution is faster because power bi calculates the formula for the column every start. Any remarks will be appreciated
@vetty
The advantage in the Power Query solution is that you don't have an extra column in the model.
The disadvantage in the Power Query solution is that you need to make sure the table is sorted by dates before applying those steps. Sorting is an expensive operation.
The dax solution will work regardless if the table is sorted before you bring it to the model.
Regarding refreshes, it depends on the folding of the query generated in Power Query to the data source. Both power query transformation and calculated cloumns are part of the refresh process of a model. It's not necessary that the Power Query solution is faster than the DAX option. In case the query is not folding good to the data source it can actually be slower that using the DAX option.
To sum it all up, as usual, the answer is: "It Depends" 🙂
Hope I was clear and that it helped you.
Very Clear, Thank you again 😉
@vetty , Power query fill down
Power Query - Fill Up, Fill Down : https://www.youtube.com/watch?v=fuH29kkK12A&list=PLPaNVDMhUXGbfdGuSsfPR1qKBRT5Ywlki&index=5
Thanks, it work like a charm!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |