Forum Discussion
Measure Output is Reversed in Stacked Column Chart
- Anonymous6 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.
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.
Anonymous works great, thanks very much again for your help!