Search code examples
restpowerquerypowerbi-datasourcedhis-2

Power query - Power Bi - Dhis2


I need help to transpose the first column in line which is added side by side with the other two columns. How to specify it in the api other than it is parameter that I must specify that the result gives what I wanted to have?

The current result

Data Organization Periode value
text1 name org1 month value1
text2 name org2 month value2
.... ..... ..... .....

the result I want

Oganization Periode text1 text2 text...
name org1 month value1 value2 ...
name org2 month value1 value2 ...

let Source = Csv.Document(Web.Contents("https://ministere-sante.mg/api/29/analytics.csv?dimension=dx:toUMbcnAgGN;O1W97xlGqBZ;arxPOcQhanb;dn8pVWUHojB;FvLKwx96Kv0;q87CgC2m7fZ;NU6LJrW5OtP;rw8lpwb5j5G;oWA1W7mmuba;qHDVI4FRFjE;qtKuAZgaMU0;rm102gbKzBZ;ACiHvHoBVtZ;IeIcIkISFW4;naBJZSepUeV;Qi1WRFJoSnU;Swv8DdBhJvC;NnYKpAzraXX;T0kBIwfDa5N;o5kVh4kRFF9;JAX5HOu665U;QkW2vpJn1z5;lhQWQlxrzOv;wiw3Y0Zkjii;uyey4mCGZLz;GPnoGnyocHS;sx7TSP921al;s0mlmmPbCdq;f3fhveMBAt2;cmaAWx5VuEx;aGmAt9Ovc57;LVZ0zsPVm3f;gr4bKti3JEw;cMN7aHkXHhs;BFeLG7TNOvq;A9PF5ZTUGPN;tHivnx60q8q;wdPJGHpacCb;M5hPC2GC9N8;bMxzvvXKsGH;Ofuxl3WRHb0;QMSuZWQIf8a;QJ6ujwA2gko;jgNrV7s1AiP;MT5wClwhTPx;ALvAHqLDm9c;HnYt4ZXti24;QiNO2NlJJNc;SGZoMo3Hx4j;Qc94kxm2YJe;i6RTvjFSehw;PP68mDkB94t;sDQlOpLyZiR;u0Akq9GFioM;dzwW7D68fMo;wNTH1o9J9QV;xdxcfEcIPIP;QcyVv7YjiZs;vr8IFPHqD2w;HfQiHEQTJ0g;hmpaTGAqd0z;D7RcnVq5INU;QAfFgIPHa3s;eXYjyu0ey8I;QuufqC3FcDL;TwYb8CZJtCz;t1ErzIjc6Rq;veCj7xnZiZf&dimension=ou:qwzcYsSzL7k;LEVEL-5&dimension=pe:LAST_MONTH&displayProperty=NAME&outputIdScheme=NAME%22),%5BDelimiter=%22,", Columns=4, Encoding=65001, QuoteStyle=QuoteStyle.None]), #"En-têtes promus" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]), #"Type modifié" = Table.TransformColumnTypes(#"En-têtes promus",{{"Data", type text}, {"Organisation unit", type text}, {"Period", type text}, {"Value", type text}}) in #"Type modifié"


Solution

  • Try

    #"Pivoted Column" = Table.Pivot(#"PriorStepNameGoesHere", List.Distinct(Source[Data]), "Data", "value")
    

    enter image description here