Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi All,
I'm pretty new to the world of PowerBI and have a problem with a certain measure that i'm trying to create.
I have several consumer goods that are classified into different level of categories.
E.g. I have product 1 which is Ice Tea that is part of Tea, which is part of Beverages which is part of Foods (Product 1 | Category level 1 | Category level 2 | Category level 3). There are several products with different category classifications on the respective levels.
Say I have data for 2 years for several products. I have 'volumes' (number of pieces sold) and 'cost' (in euro) for each product, where 'cost per piece' is calculated as Cost / Volumes. Furthermore, say I want to calculate a measure that does 'volumes (number of products sold) * cost per piece of last year'.
I was wondering if there is a way to make sure this measure always calculates on the product 1 level, so in case i filter for a certain category level 2.
E.g. with Ice Tea:
if I select filter 'Foods', it calculates total cost for 'foods' and total volumes for 'foods'. Respectively, the 'volumes (number of products sold) * cost per piece of last year' measure gets calculated on the same way.
What I actually need it to do, is calculate the 'volumes (number of products sold) * cost per piece of last year' for each product 1 level and in case i select Foods, sum the individual product 1 calculations of the different products that contain the 'foods' category level 3 classification.
I tried the following:
Hi @xanderdiederen ,
Could you please share the sample data and expected result to explain your requirement? Actually, we can create multiple separate tables for Category levels, these tables can be used for slicer, then use selectedvalue to judge which value is selected.
Best Regards,
Teige
EDIT: updated the link to the file, I have a separate mapping for 'time' that i now also included in the uploaded file.
Hi @TeigeGao
Thanks for your reply! i've upload a data sample PBI file in the following link
What you can see there as well is that for certain data rows (so certain months) in the raw data, there is no more 'cost' data for a certain product type.
E.g. say there is 'cost' data for the months Jan - Apr but not for May and June but there is 'volume' data for the months Jan - June. The measure i'm trying to calculate (Deflated YTD) then gets zero'd out completely eventhough it it should be recalculated with the additional volumes on a year to date base.
In case of unclarities please let me know!
Thanks again!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
85 | |
84 | |
67 | |
49 |
User | Count |
---|---|
131 | |
111 | |
97 | |
71 | |
67 |