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
Hello
in my example my measure dont run
i want to show : if TotalProduct is null the TotalBudget else TotalProduct at the row its ok but at the grand total it KO
Thanks a lot
Solved! Go to Solution.
Hi @EdouSav ,
This is related with the context when you add more values to your table then the context change in this case the product adds a level of granularity that changes the values, because on the month of october when you have values you do not get the 200 for 68100.
Try the following measure:
IfNotSaleThenBudget2 =
var SalesTable = SUMMARIZE (
sales,
'product'[product],
'Calendar'[Year],
'Calendar'[Month Number],
"TotalValue", [IfNotSalesThenBudget], "IDColumn",
'product'[product]& 'Calendar'[Year]&
'Calendar'[Month Number]
)
var FilterSalesValues = SELECTCOLUMNS(SalesTable, "FilterID", [IDColumn])
return
SUMX( union(
filter (SUMMARIZE (
budget,
'product'[product],
'Calendar'[Year],
'Calendar'[Month Number],
"TotalValue", [IfNotSalesThenBudget], "IDColumn",
'product'[product]& 'Calendar'[Year]&
'Calendar'[Month Number]
), NOT([IDColumn] in FilterSalesValues))
,SalesTable), [TotalValue])
Result below and in attach file:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @EdouSav ,
This is related with the context transition when you are making the comparision since the total line the value for the 42.802 so its sumt up the same value has in the other column you should do the following measure:
IfNotSalesThenBudget = SUMX(VALUES('Calendar'[Month]),if([TotalProduct]=0,[TotalBudget],[TotalProduct]))
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHello @MFelix
thanks you for your reply
but youre measure doesn't work with my model, i create a news pbix to simulate the mistake
the matrix compute 317K but the real number is 318 K
if you have another idea
many thanks
Hi @EdouSav ,
This is related with the context when you add more values to your table then the context change in this case the product adds a level of granularity that changes the values, because on the month of october when you have values you do not get the 200 for 68100.
Try the following measure:
IfNotSaleThenBudget2 =
var SalesTable = SUMMARIZE (
sales,
'product'[product],
'Calendar'[Year],
'Calendar'[Month Number],
"TotalValue", [IfNotSalesThenBudget], "IDColumn",
'product'[product]& 'Calendar'[Year]&
'Calendar'[Month Number]
)
var FilterSalesValues = SELECTCOLUMNS(SalesTable, "FilterID", [IDColumn])
return
SUMX( union(
filter (SUMMARIZE (
budget,
'product'[product],
'Calendar'[Year],
'Calendar'[Month Number],
"TotalValue", [IfNotSalesThenBudget], "IDColumn",
'product'[product]& 'Calendar'[Year]&
'Calendar'[Month Number]
), NOT([IDColumn] in FilterSalesValues))
,SalesTable), [TotalValue])
Result below and in attach file:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsMarch 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
93 | |
91 | |
91 | |
79 | |
49 |
User | Count |
---|---|
160 | |
144 | |
103 | |
72 | |
55 |