This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I was tasked to make some python visualizations with this dax code:
Inclusion_Expected =
VAR _item_number = Source_With_Trace_ID[Item_Number]
VAR _cast_date = Source_With_Trace_ID[Casting_Date]
VAR _start_date = _cast_date - 365
VAR _inclusions =
CALCULATE(
SUM(Source_With_Trace_ID[Inclusion]),
FILTER(Source_With_Trace_ID,
Source_With_Trace_ID[Item_Number] = _item_number
&& Source_With_Trace_ID[Casting_Date] >= _start_date
&& Source_With_Trace_ID[Casting_Date] < _cast_date
)
)
VAR _closed =
CALCULATE(
SUM(Source_With_Trace_ID[Closed]),
FILTER(Source_With_Trace_ID,
Source_With_Trace_ID[Item_Number] = _item_number
&& Source_With_Trace_ID[Casting_Date] >= _start_date
&& Source_With_Trace_ID[Casting_Date] < _cast_date
)
)
VAR _inclusion_scrap_rate = DIVIDE(_inclusions, _closed)
RETURN _inclusion_scrap_rateI think I understand it, but when trying to translate it over I'm getting different results.
First in the filter statement, does
@JBennett12 It is doing something because of how CALCULATE replaces filtering context and the fact that you are operating essentially in the context of ALL when you are doing those CALCULATE statements. The variables at the beginning are just preserving the row context that you want to use later. You can think of the first CALCULATE statement like the following:
SUMX(
FILTER(
ALL('Source_With_Trace_ID'),
[Item_Number] = _item_number
&& [Casting_Date] >= _start_date
&& [Casting_Date] < _cast_date
),
[Inclusion]
)
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 36 | |
| 29 | |
| 29 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 40 | |
| 33 | |
| 24 | |
| 23 |