Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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"
User | Count |
---|---|
84 | |
73 | |
67 | |
42 | |
35 |
User | Count |
---|---|
109 | |
56 | |
52 | |
45 | |
43 |