Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
MarcoMizz
Frequent Visitor

DAX Measure

Dear Team 

I have a table like that

BDG categoryMonth QTY  RRT  UNITS Consumable_CCGruppo ActualCost  WD 
Material code101/01/2023     3.448,00   1.651,00   398.557,00MIXING   15.931,08   21,37
Material code201/01/2023   22.016,00   1.651,00   398.557,00MIXING   43.827,31   21,37
Material code301/01/2023   22.611,00   1.651,00   398.557,00MATERIAL 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

1 ACCEPTED SOLUTION
Alf94
Solution Supplier
Solution Supplier

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,

View solution in original post

5 REPLIES 5
MarcoMizz
Frequent Visitor

probably my request is not so clear.

I have table A, the structure of this table is:

MarcoMizz_0-1688551283579.png

 

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

Alf94
Solution Supplier
Solution Supplier

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?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.