Forum Discussion
nattanarcilla
4 years agoFrequent Visitor
How to Calculate Win (%) for Matrix Table
I want to include the Win (%) in my Matrix table but I can't seem to figure it out. Do I need to include a Win (%) row in my data? or is there another way to dot it with DAX? Win Win Los...
- 4 years ago
from the format pane of the visual activate the columns total. Then adust your measures as folows:
Current Month = VAR CurrentMonth = CALCULATE ( SUM ( [Value] ), [Month] = MAX ( [Slicer Month] ) ) VAR YeartoMonth = CALCULATE ( SUM ( [Value] ), [Month] <= MAX ( [Slicer Month] ) && [Month] >= MIN ( [Slicer Month] ) ) RETURN IF ( HASONEVALUE ( [Category] ), CurrentMonth, FORMAT ( DIVIDE ( CurrentMonth, YeartoMonth ), "Percent" ) )Year to Month = VAR CurrentMonth = CALCULATE ( SUM ( [Value] ), [Month] = MAX ( [Slicer Month] ) ) VAR YeartoMonth = CALCULATE ( SUM ( [Value] ), [Month] <= MAX ( [Slicer Month] ) && [Month] >= MIN ( [Slicer Month] ) ) RETURN IF ( HASONEVALUE ( [Category] ), YeartoMonth, FORMAT ( DIVIDE ( CurrentMonth, YeartoMonth ), "Percent" ) )However, not sure how you calculated the percentage so you might need to adjust based on your requirement.
tamerj1
4 years agoCommunity Champion
from the format pane of the visual activate the columns total. Then adust your measures as folows:
Current Month =
VAR CurrentMonth =
CALCULATE ( SUM ( [Value] ), [Month] = MAX ( [Slicer Month] ) )
VAR YeartoMonth =
CALCULATE (
SUM ( [Value] ),
[Month] <= MAX ( [Slicer Month] )
&& [Month] >= MIN ( [Slicer Month] )
)
RETURN
IF (
HASONEVALUE ( [Category] ),
CurrentMonth,
FORMAT ( DIVIDE ( CurrentMonth, YeartoMonth ), "Percent" )
)Year to Month =
VAR CurrentMonth =
CALCULATE ( SUM ( [Value] ), [Month] = MAX ( [Slicer Month] ) )
VAR YeartoMonth =
CALCULATE (
SUM ( [Value] ),
[Month] <= MAX ( [Slicer Month] )
&& [Month] >= MIN ( [Slicer Month] )
)
RETURN
IF (
HASONEVALUE ( [Category] ),
YeartoMonth,
FORMAT ( DIVIDE ( CurrentMonth, YeartoMonth ), "Percent" )
)
However, not sure how you calculated the percentage so you might need to adjust based on your requirement.
nattanarcilla
4 years agoFrequent Visitor
Thank you very much, my actual data is bit different but this leads me to what I want. I just added FORMAT () to RETURN percentage instead of decimal.
- tamerj14 years agoCommunity Champion
Great. But I already included FORMAT in my formula