Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I want want to get the repartition on a string variable.
The variable is "COUNTRY" :
COUNTRY | NOTE |
Italy | 90 |
Italy | 90 |
China | 90 |
and i want to get
COUNTRY | NOTE | Wheight |
Italy | 90 | 66% |
Italy | 90 | 66% |
China | 90 | 33% |
Maybe it is'nt yhe good wqay to do things. What i realy want is to exclude contry who have fews rows because they don't contribute but appears when i use median or average.
I am new in power BI so sorry if the answer is obvious.
Data source : data
Solved! Go to Solution.
Hi @MaxPav
You can use DIVIDE dax to calculate the percentage of the number of rows in different countries to the total number of rows .
Measure = DIVIDE(COUNTA('Table'[COUNTRY]),CALCULATE(COUNTA('Table'[COUNTRY]),ALL('Table')))
More info about the usage for DIVIDE dax can refer to the link :
https://docs.microsoft.com/en-us/power-bi/guidance/dax-divide-function-operator
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MaxPav
You can use DIVIDE dax to calculate the percentage of the number of rows in different countries to the total number of rows .
Measure = DIVIDE(COUNTA('Table'[COUNTRY]),CALCULATE(COUNTA('Table'[COUNTRY]),ALL('Table')))
More info about the usage for DIVIDE dax can refer to the link :
https://docs.microsoft.com/en-us/power-bi/guidance/dax-divide-function-operator
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello myself,
I found this solution.
Step 1 : Power Query
#"Personnalisée ajoutée" = Table.AddColumn(#"Autres colonnes supprimées", "Personnalisé", each 1),
#"Personnalisée ajoutée1" = Table.AddColumn(#"Personnalisée ajoutée", "Personnalisé.1", each List.Sum(#"Personnalisée ajoutée"[Personnalisé])),
#"Colonnes renommées1" = Table.RenameColumns(#"Personnalisée ajoutée1",{{"Personnalisé.1", "Nb ligne"}}),
#"Autres colonnes supprimées1" = Table.SelectColumns(#"Colonnes renommées1",{"Num_Ligne", "country", "points", "price", "province", "region_1", "region_2", "title", "variety", "winery", "Nb ligne"})
Step 2 : Power BI, measures
Nb_Ligne_Country = COUNTA('winemag-data-130k-v2'[country])
TotalLigne = MAX('winemag-data-130k-v2'[Num_Ligne])
Poids = [Nb_Ligne_Country]/[TotalLigne]
I put this solution in case someone really needs it. However I think there must be a cleaner solution.
User | Count |
---|---|
102 | |
92 | |
85 | |
78 | |
71 |
User | Count |
---|---|
113 | |
104 | |
101 | |
73 | |
65 |