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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Vandergledison
Helper III
Helper III

EDITED: Stacked Bar chart by Year

EDITED: for the sake of clarity i have to EDIT this post:

So, what i need help is to get a Chart containing the Contac count of (Passive, No Reply, promoter, etc) by Year (2019 and 2020)

the problem is: in 2020 for example, if an "Alert" reply was "Passive" in the begining of the year and "no Reply" later in the same year, it should count only for "Passive", The "No Reply" should count only if there is only "No Reply", any other answer in the same year, it should take that input (passive, promoter, etc).

basically i need to collect only the latest answers that gave some result, the ones that have only "No reply" should that acount for the No replay bucket.

i hope is a bit more clearer.

thanks a lot

 

ContactDateAlert
AJuly 2019Passive
AJanuary 2020Passive
AJuly 2020No reply
BJune 2019Passive
CApril 2019No reply
CNovember 2019No reply
CMay 2020No reply
DMarch 2020No reply

 

 

Data 

 

 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @Vandergledison ,

 

We can add an index column and pivot it, then create four measures to meet your requirement.

 

1. Add a year column and an index column in Power Query Editor.

 

EDITED1.jpg

 

2. Then remove the Date column and pivot the index.

 

EDITED2.jpg

 

3. At last, we need to create four measures and put them in table visual.

 

Passive measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    NOT ( ISBLANK ( 'Table (2)'[Passive] ) )
)

 

No reply measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    ISBLANK ( 'Table (2)'[Passive] ),
    ISBLANK ( 'Table (2)'[Promoter] ),
    ISBLANK ( 'Table (2)'[Detractor] ),
    NOT ( ISBLANK ( 'Table (2)'[No reply] ) )
)

 

Promoter measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    NOT ( ISBLANK ( 'Table (2)'[Promoter] ) )
)

 

Detractor measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    NOT ( ISBLANK ( 'Table (2)'[Detractor] ) )
)

 

EDITED3.jpg

 

Edited4.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

4 REPLIES 4
v-zhenbw-msft
Community Support
Community Support

Hi @Vandergledison ,

 

We can add an index column and pivot it, then create four measures to meet your requirement.

 

1. Add a year column and an index column in Power Query Editor.

 

EDITED1.jpg

 

2. Then remove the Date column and pivot the index.

 

EDITED2.jpg

 

3. At last, we need to create four measures and put them in table visual.

 

Passive measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    NOT ( ISBLANK ( 'Table (2)'[Passive] ) )
)

 

No reply measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    ISBLANK ( 'Table (2)'[Passive] ),
    ISBLANK ( 'Table (2)'[Promoter] ),
    ISBLANK ( 'Table (2)'[Detractor] ),
    NOT ( ISBLANK ( 'Table (2)'[No reply] ) )
)

 

Promoter measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    NOT ( ISBLANK ( 'Table (2)'[Promoter] ) )
)

 

Detractor measrue = 
CALCULATE (
    COUNT ( 'Table (2)'[Contact] ),
    NOT ( ISBLANK ( 'Table (2)'[Detractor] ) )
)

 

EDITED3.jpg

 

Edited4.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

hi . Thanks a lot, this works to a certain extend.

my problem is that the final goal is to cluster the responses considering their answers. For example, if in 2019 the answer was "no replay" and in 2020 was " promoter" than i should be able to count this contact as " no reply/promoter" or "no reply/no reply" and so far. i think i need to split the years:

it is possible to pivot the table containing Text? to transfer the 2019 and 2020 in two separate columns containing the corresponding Alert answers?

ContactDateAlert
AJuly 2019Passive
AJanuary 2020Passive
AJuly 2020No reply
BJune 2019Passive
CApril 2019No reply
CNovember 2019No reply
CMay 2020No reply
DMarch 2020No reply
ENovember 2019Promoter
ESeptember 2020Promoter
FJuly 2019Promoter
FMarch 2020Promoter
GMay 2019No reply
GNovember 2019No reply
HMarch 2019Promoter
HSeptember 2019Promoter
ISeptember 2019Passive
IMarch 2020No reply
JMay 2019No reply
JJanuary 2020No reply
JJuly 2020No reply
KOctober 2019No reply
KAugust 2020No reply
WMay 2019Detractor
WSeptember 2019No reply
WAugust 2020No reply
amitchandak
Super User
Super User

@Vandergledison , Not able to access your file. Please share again

 

 

Looking at this you might have unpivot the measures. and take year or contact as a legend.

https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/

mhossain
Solution Sage
Solution Sage

@Vandergledison 

 

Structure your data:

 

--Unpivot/multirow your data in a way so that, you have Year single column having values 2019, 2020

 

Now you creat measure for count.

 

Create stake chart, drag year to x axis, color to legend and count measure to the value section.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.