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.
Dear Team
I have a table like that
BDG category | Month | QTY | RRT | UNITS | Consumable_CCGruppo | ActualCost | WD |
Material code1 | 01/01/2023 | 3.448,00 | 1.651,00 | 398.557,00 | MIXING | 15.931,08 | 21,37 |
Material code2 | 01/01/2023 | 22.016,00 | 1.651,00 | 398.557,00 | MIXING | 43.827,31 | 21,37 |
Material code3 | 01/01/2023 | 22.611,00 | 1.651,00 | 398.557,00 | MATERIAL PREPARATION | 80.200,61 | 21,37 |
I need to create a DAX measure that based on the value of column "BDG category" make a specific calcutation, just for exmaple:
1 - in case "BDG category" is equal to "Material code1" the calculation should be "QTY" / "WD"
2 - in case "BDG category" is equal to "Material code2" the calcualtion should be "QTY" / "UNITS"
3 - in case "BDG category" is equal to "Material code3" the calcualtion should be "QTY" / "RRT"
can someone suggest to me the DAX measure to be used?
regards
marco
Solved! Go to Solution.
Hi @MarcoMizz ,
I think you can use something like the following:
Measure =
SWITCH(
SELECTEDVALUE(Table[BDG Category]),
"Material code1", DIVIDE(Sum(Table[Quantity]), Sum(Table[WD])),
"Material code2", DIVIDE(Sum(Table[Quantity]), Sum(Table[UNITS])),
"Material code3", DIVIDE(Sum(Table[Quantity]), Sum(Table[RRT]))
)
If I answered your question, please mark my post as a solution.
Best,
probably my request is not so clear.
I have table A, the structure of this table is:
I dont want to add a new column, I would like to build a DAX measure that on the value of column "BDG category" make a specific calcutation, just for exmaple:
1 - in case "BDG category" is equal to "Material code1" the calculation should be "QTY" / "WD"
2 - in case "BDG category" is equal to "Material code2" the calcualtion should be "QTY" / "UNITS"
3 - in case "BDG category" is equal to "Material code3" the calcualtion should be "QTY" / "RRT"
regards
marco
Hi @MarcoMizz ,
I think you can use something like the following:
Measure =
SWITCH(
SELECTEDVALUE(Table[BDG Category]),
"Material code1", DIVIDE(Sum(Table[Quantity]), Sum(Table[WD])),
"Material code2", DIVIDE(Sum(Table[Quantity]), Sum(Table[UNITS])),
"Material code3", DIVIDE(Sum(Table[Quantity]), Sum(Table[RRT]))
)
If I answered your question, please mark my post as a solution.
Best,
thanks Alf94 this is working well!
Hi Alf94,
thanks for your replay, there is onething that I do not understand in your formula, what is "Table[BDG Category]" in you DAX expression?
regards
marco
BDG Category is your column's name. Did you try the measure?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
19 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
25 | |
10 | |
10 | |
9 | |
6 |