Forum Discussion
nh27
1 year agoHelper III
Help creating a stacked chart by multiple columns
Hi, I am trying to create a stacked bar chart which shows 4 products currently split by column and there are different phases of the product. I have attached sample data and expected output. Is th...
- Anonymous1 year ago
Hi nh27 ,
I made a sample for you with dax.
Measure = SWITCH(SELECTEDVALUE('Table'[Value]), "Product A",COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product A])))), "Product B",CALCULATE( COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product B])))),USERELATIONSHIP(Table1[Product B],'Table 2'[Value])), "Product C",CALCULATE( COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product C])))),USERELATIONSHIP(Table1[Product C],'Table 2'[Value])), "Product D",CALCULATE( COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product D])))),USERELATIONSHIP(Table1[Product D],'Table 2'[Value])) )Best Regards,
Wearsky
Anonymous
1 year agoNot applicable
Hi nh27 ,
I made a sample for you with dax.
Measure = SWITCH(SELECTEDVALUE('Table'[Value]),
"Product A",COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product A])))),
"Product B",CALCULATE( COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product B])))),USERELATIONSHIP(Table1[Product B],'Table 2'[Value])),
"Product C",CALCULATE( COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product C])))),USERELATIONSHIP(Table1[Product C],'Table 2'[Value])),
"Product D",CALCULATE( COUNTROWS(FILTER('Table1',NOT(ISBLANK([Product D])))),USERELATIONSHIP(Table1[Product D],'Table 2'[Value]))
)
Best Regards,
Wearsky
- nh271 year agoHelper III
Thank you very much, this worked a charm!