Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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 ReportingIf you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 6 | |
| 5 |