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.
Hi everyone, I'm looking for some ideas. I have a measure called "Position," and I need to create a measure called "GOAL" (which should be the sum of "Position" but with a total of 100%). The current approach I tried involves adding the Product ID level, which is causing heavy loading and resulting in an error: "The operation was canceled due to locking conflicts."
Position =
VAR TotalRev =
CALCULATE(
[revenue],
REMOVEFILTERS(ID[Product ID])
)
VAR Result =
DIVIDE([revenue], TotalRev, 0)
RETURN
Result
GOAL =
VAR IDSales = [Position]
RETURN
IF(
ISBLANK(IDSales),
BLANK(),
VAR Table =
ADDCOLUMNS(
ALL(ID[Product ID]),
"@Position",
[Position]
)
VAR FilteredTable =
FILTER(
Table,
[@Position] >= IDSales
)
VAR Result =
SUMX(
FilteredTable,
[@Position]
)
RETURN
Result
)
Hi @Julia2023 ,
You can calculate the total sum of the "Position" measure. And then Divide each "Position" value by the total sum to get the percentage.
TotalPosition =
CALCULATE(
SUM('YourTable'[Position]),
REMOVEFILTERS('YourTable')
)
GOAL =
DIVIDE(
SUM('YourTable'[Position]),
TotalPosition,
0
)
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Julia2023 What I understood about your Goal measure in your provided image, that it is calculating cumulative sum of position based on product ID.
If this is the case, then you should rank your position decending order and evaluate cumulative sum. You can try below 2 measure.
Rank Measure:
ProductKeyRank =
RANKX(
ALLSELECTED(DimProduct[ProductKey]),
[Position],
,
DESC,
DENSE
)
We will filter product table based on this rank and feed this table to calculate function to sum up position to construct 100%.
Goal Measure:
Goal =
VAR CurrentRank = [ProductKeyRank]
RETURN
CALCULATE(
[Position],
FILTER(
ALLSELECTED(DimProduct[ProductKey]),
[ProductKeyRank] <= CurrentRank
)
)
Change column name according to your table column name. You could rank any dimension based on this technique and conduct cumulative sum.
Here is the output of my goal measure:
You can avoid total level by using inscope or hasonevalue function.
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Thank you for the idea. It works when using a filter, but without any filter, loading and nothing... maybe it's because have more than 180k product IDs
Hi @Julia2023
This measure below creates a virtual summary table by product id containing a column called @position which returns a value if [goal] is equal to 1.
SUMX (
ADDCOLUMNS (
SUMMARIZE ( 'table', 'table'[product id] ),
"@position", IF ( [goal] = 1, [position] )
),
[@position]
)
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
119 | |
83 | |
47 | |
42 | |
33 |
User | Count |
---|---|
190 | |
78 | |
72 | |
54 | |
45 |