Forum Discussion

BMFormation's avatar
BMFormation
New Member
5 years ago
Solved

UnPivot DAX

Hello,   I am looking for a project, according to a number of months between 2 dates, resources in a matrix (see illustration)     I thought about doing either doing a benchmark query to b...
  • lbendlin's avatar
    5 years ago

    Like this for example:

     

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLWN9c3MjAyBDINDfSNDWEcAz0QaaQUqxOt5ARkmembwNUZ6hsbwDhGIDOUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Projet = _t, #"Date prévi début" = _t, #"Date prévi fin" = _t, Direction = _t, #"Chef de projet" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date prévi début", type date}, {"Date prévi fin", type date}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each List.Dates([Date prévi début],1+Duration.Days([Date prévi fin]-[Date prévi début]),#duration(1,0,0,0))),
        #"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date")
    in
        #"Expanded Date"

    "Total"  is a measure 

    Total = AVERAGE(Projets[Chef de projet])+AVERAGE(Projets[Direction])