Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
I am trying to create a Gross Margin Mix- for this I would use the following calculations
GrossMargin(per Row) / The Sum of all comparable Gross margins
I have a column with Gross Margin and a Column stating whether the item is comparable (Yes/No)
The formula can either be based on CY or PY.
Thank you
Solved! Go to Solution.
You should do this in Power BI with DAX, not Power Query. It will not perform well in Power Query as it isn't designed to dynamically filter tables. See below.
Some Measure =
VAR varComparable = SELECTEDVALUE('Table'[Comparable])
VAR varNumerator = SUM('Table'[Gross Margin CY])
VAR varDenominator =
CALCULATE(
SUM('Table'[Gross Margin PY]),
'Table'[Comparable] = varComparable
)
RETURN
DIVIDE(varNumerator, varDenominator, BLANK())
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingYou should do this in Power BI with DAX, not Power Query. It will not perform well in Power Query as it isn't designed to dynamically filter tables. See below.
Some Measure =
VAR varComparable = SELECTEDVALUE('Table'[Comparable])
VAR varNumerator = SUM('Table'[Gross Margin CY])
VAR varDenominator =
CALCULATE(
SUM('Table'[Gross Margin PY]),
'Table'[Comparable] = varComparable
)
RETURN
DIVIDE(varNumerator, varDenominator, BLANK())
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingShare feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 13 | |
| 11 | |
| 11 | |
| 7 | |
| 6 |