Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Blue2k
Regular Visitor

Mobile Data Usage Disparities

Hello,

 

Using power bi I am trying to find the largest disparities between users monthly date usages. I am having trouble trying to get this. 
 
Here is an example data set, I am not sure if I should add a column to put the calculations in. I want to be able to have show through a visual too. 

UsernameData usage (GBs)Month
csherborn036Jan
llorenzetti184Jan
thuddlestone286Jan
tleseka56Jan
csherborn080Feb
llorenzetti172Feb
thuddlestone263Feb
tleseka69Feb
csherborn092Apr
llorenzetti183Apr
thuddlestone274Apr
tleseka66Apr

 

Any help would be great!

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY8xDoMwDEXv4pkBEprAyMLAFSIGKJaoiBIU3KWnbzIABrF4eE9fTzYG3tuMYfTB5ZCBVPF0g4M+M2CtD+h+SPQpIq5K5mj+TpPFjbxDkSQfUhS4DJG8OL6UqnRaHJ9KWjB3LynJ5VFSNcOXUp1WzRoef5LM3Uu65PIsqR33fw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Username = _t, #"Data usage (GBs)" = _t, Month = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Username", type text}, {"Data usage (GBs)", Int64.Type}, {"Month", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Username"}, {{"Max", each List.Max([#"Data usage (GBs)"]), type nullable number}, {"Min", each List.Min([#"Data usage (GBs)"]), type nullable number},{"Diff", each List.Max([#"Data usage (GBs)"])-List.Min([#"Data usage (GBs)"]), type nullable number}})
in
    #"Grouped Rows"

 

View solution in original post

3 REPLIES 3
Blue2k
Regular Visitor

I got this to work for the table that I put up there. This is what I want! How would I change the source to the files that I am using? 
And would I have to get rid of anything else in the text?

Get the data of your source in PQ.

Select entire table and do a changed type to set data type.

Open Adavanced Editor and paste following code after Changed type step (don't forget comma after Changed type step)

    #"Grouped Rows" = Table.Group(#"Changed Type", {"Username"}, {{"Max", each List.Max([#"Data usage (GBs)"]), type nullable number}, {"Min", each List.Min([#"Data usage (GBs)"]), type nullable number},{"Diff", each List.Max([#"Data usage (GBs)"])-List.Min([#"Data usage (GBs)"]), type nullable number}})
in
    #"Grouped Rows"
Vijay_A_Verma
Super User
Super User

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY8xDoMwDEXv4pkBEprAyMLAFSIGKJaoiBIU3KWnbzIABrF4eE9fTzYG3tuMYfTB5ZCBVPF0g4M+M2CtD+h+SPQpIq5K5mj+TpPFjbxDkSQfUhS4DJG8OL6UqnRaHJ9KWjB3LynJ5VFSNcOXUp1WzRoef5LM3Uu65PIsqR33fw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Username = _t, #"Data usage (GBs)" = _t, Month = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Username", type text}, {"Data usage (GBs)", Int64.Type}, {"Month", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Username"}, {{"Max", each List.Max([#"Data usage (GBs)"]), type nullable number}, {"Min", each List.Min([#"Data usage (GBs)"]), type nullable number},{"Diff", each List.Max([#"Data usage (GBs)"])-List.Min([#"Data usage (GBs)"]), type nullable number}})
in
    #"Grouped Rows"

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors