Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have this in my table:
DATE | LIM FDO | LIM FRP | UND |
26/fev | 208 | 686 | A |
26/fev | 939 | 2166 | B |
And I need show this like a table in my dashboard:
DATE | VALOR | UND | DES |
26/fev | 208 | A | LIM FDO |
26/fev | 939 | B | LIM FDO |
26/fev | 686 | A | LIM FRP |
26/fev | 2166 | B | LIM FRP |
I don´t have idea how to do this in DAX, and I need make this in DAX
Solved! Go to Solution.
Hi @caslus ,
DAX way :
Table 2 =
VAR a =
SELECTCOLUMNS ( 'Table', "und", 'Table'[UND], "date_", 'Table'[DATE] )
VAR k =
CROSSJOIN ( { "LIM FDO", "LIM FRP" }, a )
RETURN
ADDCOLUMNS (
k,
"result", IF (
[Value] = "LIM FDO",
CALCULATE ( SUM ( 'Table'[LIM FRP] ) ),
IF ( [Value] = "LIM FRP", CALCULATE ( SUM ( 'Table'[LIM FDO] ) ) )
)
)
Pbix as attached.
Hi @caslus ,
DAX way :
Table 2 =
VAR a =
SELECTCOLUMNS ( 'Table', "und", 'Table'[UND], "date_", 'Table'[DATE] )
VAR k =
CROSSJOIN ( { "LIM FDO", "LIM FRP" }, a )
RETURN
ADDCOLUMNS (
k,
"result", IF (
[Value] = "LIM FDO",
CALCULATE ( SUM ( 'Table'[LIM FRP] ) ),
IF ( [Value] = "LIM FRP", CALCULATE ( SUM ( 'Table'[LIM FDO] ) ) )
)
)
Pbix as attached.
I believe you want to unpivot your two middle columns, like this:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnEMcVXSUfLx9FVwc/GHsYICgKxQPxelWJ1oJSMz/bTUMqCAkYEFkDSzMAOSjqhSlsaWIAWGZiA5J6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"DATE", type text}, {"LIM FDO", Int64.Type}, {"LIM FRP", Int64.Type}, {"UND", type text}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type1", {"DATE", "UND"}, "Attribute", "Value")
in
#"Unpivoted Columns"
This is in power query?
I need made this in DAX, becouse I have anothers columns in my table.
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |