Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Please Help!
My power BI
I want to make this :
My code:
Cumulative Percentage =
// Define variables
VAR SelectedSeason = "58 SS23"
VAR CurrentProductClass = SELECTEDVALUE('Ordered Lines'[Product Class])
VAR CurrentAccountNumber = SELECTEDVALUE('Ordered Lines'[Account Number])
VAR CurrentItemCode = SELECTEDVALUE('Ordered Lines'[Item Code and Colour])
// Calculate the total GBP for the selected product class and account number
VAR TotalGBPbyProductAndAccount =
CALCULATE(
SUM('Ordered Lines'[GBP]),
'Ordered Lines'[Order Season] = SelectedSeason,
'Ordered Lines'[Product Class] = CurrentProductClass,
'Ordered Lines'[Account Number] = CurrentAccountNumber
)
VAR ItemsWithHigherOrEqualTotalGBP =
FILTER(
ALLSELECTED('Ordered Lines'[Item Code and Colour]),
CALCULATE(
SUM('Ordered Lines'[GBP]),
'Ordered Lines'[Order Season] = SelectedSeason,
'Ordered Lines'[Product Class] = CurrentProductClass,
'Ordered Lines'[Account Number] = CurrentAccountNumber,
'Ordered Lines'[Item Code and Colour] = EARLIER('Ordered Lines'[Item Code and Colour])
) >= CALCULATE(
SUM('Ordered Lines'[GBP]),
'Ordered Lines'[Order Season] = SelectedSeason,
'Ordered Lines'[Product Class] = CurrentProductClass,
'Ordered Lines'[Account Number] = CurrentAccountNumber,
'Ordered Lines'[Item Code and Colour] = CurrentItemCode
)
)
VAR CumulativeGBPbyItemCode =
CALCULATE(
SUM('Ordered Lines'[GBP]),
'Ordered Lines'[Order Season] = SelectedSeason,
'Ordered Lines'[Product Class] = CurrentProductClass,
'Ordered Lines'[Account Number] = CurrentAccountNumber,
'Ordered Lines'[Item Code and Colour] IN ItemsWithHigherOrEqualTotalGBP,
ALLSELECTED('Ordered Lines'[Item Code and Colour])
)
// Return the Cumulative Percentage by dividing Cumulative GBP by Total GBP
RETURN DIVIDE(CumulativeGBPbyItemCode, TotalGBPbyProductAndAccount)
Solved! Go to Solution.
Hi @mattchunghk ,
It is recommended to create a new calculation table like this:
We need [CumulativeGBPbyItemCode] for sort.
Please check the pbix file.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @mattchunghk ,
It is recommended to create a new calculation table like this:
We need [CumulativeGBPbyItemCode] for sort.
Please check the pbix file.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
13 | |
12 | |
11 | |
11 | |
8 |