Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello -
Performing below measure calculation to be used in other measures, matrix and multiple visuals. But, the calculation takes huge amount of time. To accelerate the processing, how can I first filter by a GROUP column and then calculate this measure?
calc_cost = sum(F_COST[COST])*IF(SUM(F_COST[QTY])==0,1,SUM(F_COST[QTY]))
I guess something to do with "CALCULATE" and add some type of filters: ALL SELECTED, KEEP FILTERS. Not sure how to appropriately use them or if this logic is effecient. Kindly assist with a logical/sample solution
First attempt:
Tried the below, only to CALCULATE for a Selected GROUP from Slicer. There is no change in the processing time (takes minutes). Please assist with a sample code...
Calc_total_cost = CALCULATE(sum(F_COST[COST_PER_UOM])*IF(SUM(F_COST[QTY])==0,1,SUM(F_COST[QTY])),ALLSELECTED(F_COST[GROUP]))
For waiting for +5min
TIA
Solved! Go to Solution.
Hi @spartanboy ,
Power BI bad performance should be caused by many elements like large size of data, complex data model, complex calculation/query, poor data source response (direct query/live connection) ,too many visuals and so on.
I think your measure is easy. The long duration should not be caused by your code.
calc_cost = sum(F_COST[COST])*IF(SUM(F_COST[QTY])==0,1,SUM(F_COST[QTY]))
So I think you should optmize Power BI performance by data model.
Here is an offical blog and I hope it could help you.
For reference: Optimization guide for Power BI
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Can you tell us what you want to achieve?
The formulas above don't make much sense without context (your goal?)
BR
Expectation is to just calc_COST using F_COST[QTY] and F_COST[COST], and the created measure calc_COST - will be used in other measure ans visuals.
Hi @spartanboy ,
Power BI bad performance should be caused by many elements like large size of data, complex data model, complex calculation/query, poor data source response (direct query/live connection) ,too many visuals and so on.
I think your measure is easy. The long duration should not be caused by your code.
calc_cost = sum(F_COST[COST])*IF(SUM(F_COST[QTY])==0,1,SUM(F_COST[QTY]))
So I think you should optmize Power BI performance by data model.
Here is an offical blog and I hope it could help you.
For reference: Optimization guide for Power BI
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
YourMeasure = SUMX(F_COST, F_COST[QTY] * F_COST[COST])
no need for calculate and stuff.
@spartanboy you cannot use IF function inside in the above fashion. What do you want ot achieve!?
Proud to be a Super User!
IF function in the original DAX does work. Expectation is to calc_COST using F_COST[QTY] and F_COST[COST]
Create Aggregations separately and use them in Calculate , currently you have used them inside calculate as SUM(Column) that must be causing latency!
Proud to be a Super User!
Tried the below, only to CALCULATE for a Selected GROUP from Slicer. There is no change in the processing time (takes minutes). Please assist with a sample code... TIA
Calc_total_cost = CALCULATE(sum(F_COST[COST_PER_UOM])*IF(SUM(F_COST[QTY])==0,1,SUM(F_COST[QTY])),ALLSELECTED(F_COST[GROUP]))
For waiting for +5min
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
75 | |
63 | |
52 | |
47 |
User | Count |
---|---|
218 | |
86 | |
64 | |
63 | |
60 |