Forum Discussion
Please help - percentage across multiple rows
- Anonymous5 years ago
Hi Anonymous ,
Is the image below what you intend?
If yes here is the m-query code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCijKz0pNLlFwVNJRci4tLsnPTS1SCEotLE0tLklNUYrVQShxIqzEmbASCiyKBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Customer = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", type text}, {"Customer", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
#"Grouped Rows" = Table.Group(#"Added Index", {"Project", "Customer"}, {{"Test", each Table.RowCount(_), Int64.Type}})
in
#"Grouped Rows"And for the last step just create a metric in this format:
% of Grand Total =DIVIDE (SUM( 'Table 1'[Test] ),CALCULATE ( SUM ( 'Table 1'[Test]), ALL ( 'Table 1'[Project]) ))You will be able to then stick it as filter page, visual or entire report.Best Regards,ID - Anonymous5 years ago
Hi Anonymous ,
You could use the following formula to create a calculated table :
New Table = SUMMARIZE ( 'Table', [Project Name], "% Customer Requested", VAR _count = CALCULATE ( COUNTROWS ( 'Table' ), ALLEXCEPT ( 'Table', 'Table'[Project Name] ) ) VAR _custom = CALCULATE ( COUNT ( 'Table'[Request Type] ), FILTER ( 'Table', 'Table'[Request Type] = "Customer Requested" ) ) RETURN FORMAT ( DIVIDE ( _custom, _count ), "##%" ) & " Customer Requested" )The final output is shown below:
Please take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.
Best Regards,
Eyelyn Qin