Forum Discussion
Dynamic Pareto chart - with field parameters not working
- 2 years ago
Hello,
You can use visual "Pareto+" to create a graph and table. The visual with do all of the calculations for you. You can also use "Pareto by sio2Graphs" to produce the graph, no need for measures.
😀
sio2Graphs
cousinitt13 , Try using below DAX
Pareto % =
IF(
1, //ISINSCOPE(par_stop_category[par_stop_category Name]),
VAR __AllselectedStops =
SWITCH(
SELECTEDVALUE(par_stop_category[par_stop_category Name]),
"Main", SUMMARIZE(dim_stop_code, dim_stop_code[mn_description]),
"Harm", SUMMARIZE(dim_stop_code, dim_stop_code[hrm_description]),
"Place", SUMMARIZE(dim_stop_code, dim_stop_code[plc_description]),
"Reason", SUMMARIZE(dim_stop_code, dim_stop_code[rsn_description]),
"Code", SUMMARIZE(dim_stop_code, dim_stop_code[code_description]),
"Category", SUMMARIZE(dim_stop_code, dim_stop_code[ctgry_description]),
"Group", SUMMARIZE(dim_stop_code, dim_stop_code[grp_description]),
"Error Place", SUMMARIZE(dim_error_code, dim_error_code[erplc_description]),
"Error Code", SUMMARIZE(dim_error_code, dim_error_code[errcd_description])
)
VAR __StopTable = ADDCOLUMNS(__AllselectedStops, "@Count", [Stops #])
VAR __CurrentCount = [Stops #]
VAR __CumStopTable = FILTER(__StopTable, [@Count] >= __CurrentCount)
VAR __CumStop = SUMX( __CumStopTable, [@Count])
VAR __AllSelectedStopsCount = CALCULATE([Stops #], __AllselectedStops)
VAR __Result = DIVIDE(__CumStop, __AllSelectedStopsCount)
RETURN
IF(__CurrentCount > 0, __Result, BLANK())
)
thanks, but still getting this error
"
The ADDCOLUMNS function expects a table expression for argument '', but a string or numeric expression was used."
- bhanu_gautam2 years ago
Super User
cousinitt13 , Try using updated one
Pareto % =
IF(
1, //ISINSCOPE(par_stop_category[par_stop_category Name]),
VAR __SelectedColumn =
SWITCH(
SELECTEDVALUE(par_stop_category[par_stop_category Name]),
"Main", dim_stop_code[mn_description],
"Harm", dim_stop_code[hrm_description],
"Place", dim_stop_code[plc_description],
"Reason", dim_stop_code[rsn_description],
"Code", dim_stop_code[code_description],
"Category", dim_stop_code[ctgry_description],
"Group", dim_stop_code[grp_description],
"Error Place", dim_error_code[erplc_description],
"Error Code", dim_error_code[errcd_description]
)
VAR __AllselectedStops = SUMMARIZE(ALLSELECTED(__SelectedColumn), __SelectedColumn)
VAR __StopTable = ADDCOLUMNS(__AllselectedStops, "@Count", [Stops #])
VAR __CurrentCount = [Stops #]
VAR __CumStopTable = FILTER(__StopTable, [@Count] >= __CurrentCount)
VAR __CumStop = SUMX(__CumStopTable, [@Count])
VAR __AllSelectedStopsCount = CALCULATE([Stops #], ALLSELECTED(__SelectedColumn))
VAR __Result = DIVIDE(__CumStop, __AllSelectedStopsCount)
RETURN
IF(__CurrentCount > 0, __Result, BLANK())
) --If you still face issue share sample data