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
Dear Community,
As I have two tables, DB and ActualProfit, I would like to look up the sum of DB table based on month and year into ActualProfit table, but Do not replace the numbers in Actual Profit that are already filled up.
This is Actual Profit table.
This is DB table.
I would like to sum the value of months February and March in the DB table then look into the Actual Profit table.
Knowing that this code can look up the total profit, but will replace the actual profit that has been filled
lookup = CALCULATE(SUM('DB'[Profit]),FILTER('DB','DB'[Month]= ActualProfit[Month] && 'DB'[Year] = ActualProfit[Year] ))
Expectation:
Any help will be greatly appreciated.
Attached with the pbix: https://drive.google.com/file/d/1x-snBm9WxQl8esw8Mz1AB4JekGj41Za5/view?usp=sharing
Solved! Go to Solution.
Hey @NickProp28 ,
You can try something like this:
lookup = if(ActualProfit[Profit]<> BLANK(),ActualProfit[Profit],CALCULATE(SUM('DB'[Profit]),FILTER('DB','DB'[Month]= ActualProfit[Month] && 'DB'[Year] = ActualProfit[Year] )))
This will create a new column taking values from the Profit if they are already there and if not, it will do the calculation and fill the result. The outcome will be as:
Will this solve the purpose?
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new column.
lookup =
VAR _condition =
ISBLANK ( ActualProfit[Profit] )
RETURN
CALCULATE (
SUM ( 'DB'[Profit] ),
FILTER (
'DB',
'DB'[Month] = ActualProfit[Month]
&& 'DB'[Year] = ActualProfit[Year]
)
) * _condition + ActualProfit[Profit]
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hey @NickProp28 ,
You can try something like this:
lookup = if(ActualProfit[Profit]<> BLANK(),ActualProfit[Profit],CALCULATE(SUM('DB'[Profit]),FILTER('DB','DB'[Month]= ActualProfit[Month] && 'DB'[Year] = ActualProfit[Year] )))
This will create a new column taking values from the Profit if they are already there and if not, it will do the calculation and fill the result. The outcome will be as:
Will this solve the purpose?
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 |