cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sharma0815
Helper II
Helper II

How to get cumulative percentage with date filter on stacked column chart

I am working on a dataset where i need percentage of each category of surveys and I am using stacked bar chart to visualize the data 

 

I have date range filter, when i change date range to one particular month percentage the bar chart is not showing like i expected that means it's not 100% cumulative

 

For example ,

responseidcategorydate
1nflkjnsldknTop21/1/2020
23dffthrghfBottom21/2/2020
sdgfgdfgdfgmiddle21/3/2020
sdasgasdggTop21/4/2020
dfdgfhadvvBottom21/5/2020
cvbghrttsdTop21/6/2020
   

 

I have survey responses from 06/01/2019 to 06/012020 and I am using below DAX to caluclate the percentage 

 

TotalSurveys = DISTINCTCOUNT(Survey[responseid])
%ofCategory = DIVIDE([TotalSurveys],CALCULATE(DISTINCTCOUNT(Survey[responseid]),ALLSELECTED(Survey))) 
 
 
I am placing caterogy on legend and it's working as I expected if i select date range for all months.
 
I want to visualize the percentage of survey by category if i change my date filter to one month.
 
For example ..in the below screenshot I've 323 surveys in Jan 2020 and i want to visualize %of surveys by category with cumulative of 100%
 

Total surveys 3200 from Jun19 to Jun20Total surveys 3200 from Jun19 to Jun20there are 323 survey in Jan 2020there are 323 survey in Jan 2020

 

Is there any way that we can achieve this by using DAX ?

 

1 REPLY 1
lbendlin
Super User
Super User

Do you have survey data for each of the categories in each of the months?  if yes then you can do a simple cumulative count against your dates table. If no then you need to use CROSSFILTER(survey date,dates date, none) to fill in the gaps.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors