Forum Discussion

hunterc's avatar
hunterc
Frequent Visitor
6 years ago
Solved

Measure Output is Reversed in Stacked Column Chart

Hi,  I have a measure that I put into a stacked column chart, but the data are flipped. In the screenshot, January should be PM Complete? 9.63% = true and 90.37% false, but as you can see, it's reve...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi hunterc 

    I update the Fact Table, Dimdate table and the measure.

    Dimdate Table:

    DimDate = 
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2020, 01, 01 ), DATE ( 2020, 12, 31 ) ),
        "Year", YEAR ( [Date] ),
        "Month #", MONTH ( [Date] ),
        "Quarter", QUARTER([Date]),
        "Fulldate Month", FORMAT([Date],"MMMM"),
        "Day", DAY ( [Date] ),
        "Datekey",
            FORMAT ( [Date], "yyyy" ) & ""
                & FORMAT ( [Date], "mm" ) & ""
                & FORMAT ( [Date], "DD" )
    )

    Add a Qtr # column in Fact Table.

    Qtr # = RELATED(DimDate[Quarter])

    Update Measure:

    Measure = 
    VAR _PerC =
        CALCULATE (
            COUNTROWS ( WorkOrders ),
            FILTER (
                ALLEXCEPT (
                    WorkOrders,
                    WorkOrders[u_asset_type_display_value],
                    WorkOrders[Complete?]
                ),
                WorkOrders[Month #] <= MAX ( WorkOrders[Month #] )
                    && WorkOrders[Qtr #] = MAX ( WorkOrders[Qtr #] )
            )
        )
    VAR _Total =
        CALCULATE (
            COUNTROWS ( 'WorkOrders' ),
            FILTER (
                ALLEXCEPT ( WorkOrders, WorkOrders[u_asset_type_display_value] ),
                WorkOrders[Month #] <= MAX ( WorkOrders[Month #] )
                    && WorkOrders[Qtr #] = MAX ( WorkOrders[Qtr #] )
            )
        )
    RETURN
        DIVIDE ( _PerC, _Total )

    Result is as below.

    Default:

    Select type in Slicer:

    You can download the pbix file from this link: Measure Output is Reversed in Stacked Column Chart

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.