J'ai besoin de créer un graphique pivot (il est censé être pivot pour le bien-être du filtrage et de l'efficacité, mais n'importe quel équivalent pourrait faire) montrant un nombre cumulatif distinct. Par exemple, j'ai un set de données:
Month ¦ Drink brand ¦ Drink type -------------------------------- 1 ¦ Abc ¦ Water 1 ¦ Def ¦ Soft 1 ¦ Abc ¦ Water 1 ¦ Ghi ¦ Soft 1 ¦ Xyz ¦ Water 2 ¦ Abc ¦ Water 2 ¦ Abc ¦ Water 2 ¦ Jkl ¦ Soft 2 ¦ Opq ¦ Soft 2 ¦ Abc ¦ Water
Et de cela, j'aimerais get un graphique:
¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
|¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
Boire |¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
type | S¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
cumulatif | []¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
unique | WSW []¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
count | [] [] [] []¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
| _ [] _ [] ___ [] _ [] _¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
1 2¦ Drink ¦ type ¦ S cumulative ¦ [] unique ¦ WSW [] count ¦ [] [] [] [] ¦_[]_[]___[]_[]_ 1 2 Month
J'ai essayé d'utiliser "Résumer les valeurs par" -> "Distinct Count" et "Afficher les valeurs comme" -> "Running Total In" dans Value Field Settings mais l'option running in semble ignorer la philosophie derrière le count distinct et ajoute simplement les counts distincts pour chaque mois.
J'ai réussi à résoudre ce problème particulier à l'aide du pivot d'alimentation et de DAX.
Voici ceci: http://www.daxpatterns.com/cumulative-total/ et l'exemple fourni du cumul cumulatif
Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
Quantité cumulative: =Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
CALCULER (Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
SUM (Transactions [Quantité]),Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
FILTRE (Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
ALL ('Date' [Date]),Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
'Date' [Date] <= MAX ('Date' [Date])Cumulative Quantity := CALCULATE ( SUM ( Transactions[Quantity] ), FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) ) )
J'ai créé deux nouveaux champs calculés ("POWERPIVOT" -> "Champs calculés"), "Water_cumulative_count":
=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
= CALCULER (=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
DISTINCTCOUNT (Range [Drink brand]),=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
FILTRE (=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
ALL (Range [Month]),=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
Plage [Mois] <= MAX (Plage [Mois])=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
),=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
FILTRE (=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
TOUT (Plage [Type de boisson]),=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
Gamme [Type de boisson] = "Eau"=CALCULATE ( DISTINCTCOUNT( Range[Drink brand] ), FILTER ( ALL ( Range[Month] ), Range[Month] <= MAX ( Range[Month] ) ), FILTER ( ALL ( Range[Drink type] ), Range[Drink type] = "Water" ) )
et analogique "Soft_cumulative_count".
Ensuite, j'ai simplement ajouté ces nouveaux champs au pivot.
Bien qu'il résolte ce problème particulier, je ne suis pas satisfait de la mauvaise qualité de cette solution. Si j'avais beaucoup de "types de boissons", il serait très inefficace de créer autant de nouveaux champs calculés. Je me request s'il existe une meilleure façon de le résoudre en utilisant DAX. Peut-être … Mais je suis un novice de 1 jour sur ce sujet.