Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext 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
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.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |