Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
nattanarcilla
Frequent 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?

 WinWinLossLossWin (%)Win (%)
PersonCurrent MonthYear to MonthCurrent MonthYear to MonthCurrent MonthYear to Month
A100030003000650025%32%
B300065004000900043%42%


Current Month = CALCULATE( SUM( [Value] ), [Month] = MAX( [Slicer Month] ) )
Year to Month = CALCULATE( SUM( [Value] ), [Month] <= MAX( [Slicer Month] ) && [Month] >= MIN( [Slicer Month] ) )

Data for the matrix is derived from 2 tables using UNION(SELECTCOLUMNS(TABLE 1 Columns),SELECTCOLUMNS(TABLE 2 Columns))

PersonMonthCategoryValue
AAprWin1000
AAprLoss1500
BAprWin1500
BAprLoss2000
AMayWin1000
AMayLoss2000
BMayWin2000
BMayLoss3000
AJunWin1000
AJunLoss3000
BJunWin3000
BJunLoss4000
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @nattanarcilla 

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. 

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @nattanarcilla 

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. 

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.

@nattanarcilla 

Great. But I already included FORMAT in my formula

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.