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
Khramana
Frequent Visitor

Word in Column count: unique and percentage

Hello Power BI masters!

I have a table "All devices", in which I have columns with device names bu users like this:

User nameDevice model
AlexSamsung A3
HeleneSamsung A1
JorgeApple 13
OlgaApple 13
RobertNokia 3310

My goal is to understand % of each model in device park like:
Samsung A3 - 20%
Samsung A1 - 20%
Apple13 - 40%
Nokia 3310 - 20%

Could you please help with correct measure syntax?
I understand that it's easier to have a static list of possible models, but it's not my way because it changes constantly...

*I also have another table that shows me the number of specific applicaton crashes on each user device.
Further I would need to compare "% of crashes by device model/all crash cases" with "% of device model/whole device models park"...
Hence, I'm looking for advice how to calculate % of models in park better so I could use the result then in next actions.

Could you please advice?

3 REPLIES 3
m_dekorte
Super User
Super User

Hi @Khramana,

 

You can leverage a Table.RowCount and Table.Group for that.

Copy this code into a new blank query

let
    TotalRows = Table.RowCount( Source ),
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsxJrVDSUQpOzC0uzUtXcDRWitWJVvJIzUnNS0UWNwSLe+UXpYOEHQsKclIVDCGK/XPSE9HFgvKTUotKgKJ++dmZiQrGxoYGSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"User name" = _t, #"Device model" = _t]),
    GroupPerc = Table.Group(Source, {"Device model"}, {{"Count", each Table.RowCount(_)/TotalRows, Percentage.Type}})
in
    GroupPerc

 

First I added a TotalRows = Table.RowCount( Source ),

Then you can use Group By on the ribbon, as key set Device Model

And for the aggregation select Count Rows, update the code in the formula bar.

 

Table.Group(Source, {"Device model"}, {{"Count", each Table.RowCount(_) /TotalRows, Percentage.Type}})

 

With this result

m_dekorte_0-1684249101918.png

 

Ps. If this helps solve your query please mark this post as Solution, thanks!

Hello @m_dekorte !
Thank you for the reply!
Let me try to do it.
Could you please give a clue what does this value mean in your measure? So I could understand and use it then also
I mean this part: i45WcsxJrVDSUQpOzC0uzUtXcDRWitW....

@Khramana 

LOL that's binary, the UI generates it automatically when you select "Enter Data" on the ribbon and create a table on the fly.

 

Hope that clarifies it.

Also please do not forget to mark the post that helped solve your query, as Solution.

 

Cheers

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