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.
I have this simple table, how can I add a percentage column?
Meaning percentage of total hours for each Type
Solved! Go to Solution.
Hi @PPalkowski ,
We can create a calculated table as below.
Table =
SUMMARIZE (
AllChanges,
AllChanges[Type],
"hours", DISTINCTCOUNT ( AllChanges[Number] ),
"Percentage", FORMAT (
DIVIDE (
DISTINCTCOUNT ( AllChanges[Number] ),
CALCULATE ( DISTINCTCOUNT ( AllChanges[Number] ), ALL ( AllChanges ) )
),
"Percent"
)
)
Pbix as attached.
Hi @PPalkowski ,
We can create a calculated table as below.
Table =
SUMMARIZE (
AllChanges,
AllChanges[Type],
"hours", DISTINCTCOUNT ( AllChanges[Number] ),
"Percentage", FORMAT (
DIVIDE (
DISTINCTCOUNT ( AllChanges[Number] ),
CALCULATE ( DISTINCTCOUNT ( AllChanges[Number] ), ALL ( AllChanges ) )
),
"Percent"
)
)
Pbix as attached.
Yikes, This works wonderful, but this is a total for Jan and Feb... I was going to add a slicer to drive monthly metrics, is there a way to create a relationship from this new table on AllChanges[Number]?
Thanks!!
Something similar to this:
Percentage =
VAR Numerator =
SUM( Table[Hours] )
VAR Denomenator =
CALCULATE(
SUM( Table[Hours] ),
REMOVEFILTERS( Table )
)
VAR Result =
DIVIDE(
Numerator,
Denomenator,
0
)
RETURN
Result
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |