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
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
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.

Top Solution Authors