Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone,
I want to calculate the sum of quantites of some products, but I have several problems. I am showing only the filtered data (based on all other categories except premium), and I want to calculate the sum of all the products where they are premium, but only for articles that are shown in the table. All of this, needs to be also calculated based on the data for the previous week (which I keep in other data table).
For example,
Article ID | Category | Total by category | Overall total |
123 | x | 3 | 100 |
234 | x | 1 | 20 |
123 | y | 32 | 100 |
123 | y | 1 | 100 |
I have used the following formula, and it calculates right, but the problem is if there is no total by category it returns a value, which is not what i want, and plus if there is no category it adds automatically some categories in the table.
VAR QUANTITY_PREVIOUS_WEEK =
CALCULATE(
SUM(Orders[packs]),
FILTER(ALL('Date'), 'Date'[Week rank]=PREVIOUS_WEEK),
FILTER(ALL(Orders[Category]), Orders[Category]="Premium")
)
Thank you in advance for your help.
Kind regards,
Stefani
Solved! Go to Solution.
I have solved my problem. It looked like I should show only the only that have no blank rows with total by category.
I have solved my problem. It looked like I should show only the only that have no blank rows with total by category.
User | Count |
---|---|
77 | |
76 | |
44 | |
31 | |
26 |
User | Count |
---|---|
97 | |
90 | |
52 | |
47 | |
46 |