Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
The problem is that if 1 is blank it is negative. If 2 is blank it is positive. I want them to be 0 if don't have 1 and 2 to show the correct total as I want.
My DAX for sum:
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
My sample data:
item | Type1 | Type2 | total |
a | 2 | -2 | 0 |
b | 1 | 1 | |
c | -3 | -3 | |
d | 6 | -3 | 3 |
e | 4 | -5 | -1 |
I don't want the calculation to occur when there are blank values and the total for that row must be 0.
@lbendlin
The results I want:
item | Type1 | Type2 | total |
a | 2 | -2 | 0 |
b | 1 | 0 | |
c | -3 | 0 | |
d | 6 | -3 | 3 |
e | 4 | -5 | -1 |
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTICYl0jpVidaKUkINMQiBXAvGQwCyhpDOamAJlmCG4qkGkC4poqxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [item = _t, Type1 = _t, Type2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"item", type text}, {"Type1", Int64.Type}, {"Type2", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "total", each if [Type1]=null or [Type2]=null then 0 else [Type1]+[Type2],Int64.Type)
in
#"Added Custom"
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
78 | |
59 | |
36 | |
33 |
User | Count |
---|---|
98 | |
62 | |
56 | |
49 | |
41 |