Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to perform a function only for a unique value from a column

Hi, i would like to get values ​​only for unique values ​​in the column in Power BI.

 

This is an example of my current table, in the backlog I used the function: 

'Backlog = IF([REALDATE] <> BLANK(),NETWORKDAYS([REALDATE],[PLANNEDDATE]),BLANK())'
NUMBERPLANNEDDATEREALDATEBACKLOG
123404.07.2211.07.22-6
123404.07.2211.07.22-6
000004.07.2214.07.22-9
999904.07.2208.07.22-5
999904.07.2208.07.22-5
999904.07.2208.07.22-5

 

and I would like to achieve something like this

 

NUMBERPLANNEDDATEREALDATEBACKLOG
123404.07.2211.07.22-6
123404.07.2211.07.22 
000004.07.2214.07.22-9
999904.07.2208.07.22-5
999904.07.2208.07.22 
999904.07.2208.07.22 

 

if the number repeats, I don't want to count the backlog for it. 

How i can do it? 

  • Hi,

    i was working on the same schema as karen578

    this is the transformations in power query

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNlHSUTIw0TMw1zMyAjINDeFMXTOlWB3i1BgAAZoaBFPXEqzGEghQ1RhYINSYUk9NLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [NUMBER = _t, PLANNEDDATE = _t, REALDATE = _t, BACKLOG = _t]),
    #"Grouped Rows" = Table.Group(Source, {"NUMBER"}, {{"AllRows", each _, type table [NUMBER=nullable text, PLANNEDDATE=nullable text, REALDATE=nullable text, BACKLOG=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([AllRows],"Index",1,1)),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"NUMBER", "PLANNEDDATE", "REALDATE", "BACKLOG", "Index"}, {"NUMBER", "PLANNEDDATE", "REALDATE", "BACKLOG", "Index"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Custom",{{"NUMBER", type text}, {"PLANNEDDATE", type date}, {"REALDATE", type date}, {"BACKLOG", Int64.Type}, {"Index", Int64.Type}})
    in
    #"Changed Type"

    and finally the dax

    Column =
    if('Table'[Index]=1, 'Table'[BACKLOG])
    If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution !

3 Replies

  • Hi,

    i was working on the same schema as karen578

    this is the transformations in power query

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNlHSUTIw0TMw1zMyAjINDeFMXTOlWB3i1BgAAZoaBFPXEqzGEghQ1RhYINSYUk9NLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [NUMBER = _t, PLANNEDDATE = _t, REALDATE = _t, BACKLOG = _t]),
    #"Grouped Rows" = Table.Group(Source, {"NUMBER"}, {{"AllRows", each _, type table [NUMBER=nullable text, PLANNEDDATE=nullable text, REALDATE=nullable text, BACKLOG=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([AllRows],"Index",1,1)),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"NUMBER", "PLANNEDDATE", "REALDATE", "BACKLOG", "Index"}, {"NUMBER", "PLANNEDDATE", "REALDATE", "BACKLOG", "Index"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Custom",{{"NUMBER", type text}, {"PLANNEDDATE", type date}, {"REALDATE", type date}, {"BACKLOG", Int64.Type}, {"Index", Int64.Type}})
    in
    #"Changed Type"

    and finally the dax

    Column =
    if('Table'[Index]=1, 'Table'[BACKLOG])
    If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution !