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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jriden37
New Member

Comparing 3 date columns in same table and showing on stacked bar graph

Hello Everyone,

I am new to this community and relatively new to PowerBi.  I am trying to build out a dashboard using a 100% stacked bar graph.

I have 3 columns in same table that I want to pull from.  These columns all have dates in them.  For each column some rows will have dates and others will not.  I want to be able to put all 3 columns into the graph each column with its own bar showing percentage of completed jobs compared to not complete.  I want to count as complete if there is a date and not complete if row is empy.  I have been able to do it with individual bar graphs for each column, but I would like to be able to add all 3 columns to one graph and just show them each on there own bar.  Showing both complete and not complete percentages on one bar

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

Hi @jriden37 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1704879280309.png

(2) We can create calculated columns.

Column_1 = IF(ISBLANK('Table'[column1]),"not complete","completed")
Column_2 = IF(ISBLANK('Table'[column2]),"not complete","completed")
Column_3 = IF(ISBLANK('Table'[column3]),"not complete","completed")

(3) We can create a measure. 

Measure 2 = 
var _a=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_1]="completed"))
var _b=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_2]="completed"))
var _c=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_3]="completed"))
var _d=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_1]="not complete"))
var _e=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_2]="not complete"))
var _f=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_3]="not complete"))
return IF(MAX('Table'[Column_1])="completed",DIVIDE(_a+_b+_c,_a+_b+_c+_d+_e+_f),DIVIDE(_d+_e+_f,_a+_b+_c+_d+_e+_f))

(4) Then the result is as follows.

vtangjiemsft_1-1704879408524.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

View solution in original post

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @jriden37 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1704879280309.png

(2) We can create calculated columns.

Column_1 = IF(ISBLANK('Table'[column1]),"not complete","completed")
Column_2 = IF(ISBLANK('Table'[column2]),"not complete","completed")
Column_3 = IF(ISBLANK('Table'[column3]),"not complete","completed")

(3) We can create a measure. 

Measure 2 = 
var _a=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_1]="completed"))
var _b=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_2]="completed"))
var _c=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_3]="completed"))
var _d=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_1]="not complete"))
var _e=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_2]="not complete"))
var _f=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_3]="not complete"))
return IF(MAX('Table'[Column_1])="completed",DIVIDE(_a+_b+_c,_a+_b+_c+_d+_e+_f),DIVIDE(_d+_e+_f,_a+_b+_c+_d+_e+_f))

(4) Then the result is as follows.

vtangjiemsft_1-1704879408524.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

v-tangjie-msft
Community Support
Community Support

Hi @jriden37 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1704879280309.png

(2) We can create calculated columns.

Column_1 = IF(ISBLANK('Table'[column1]),"not complete","completed")
Column_2 = IF(ISBLANK('Table'[column2]),"not complete","completed")
Column_3 = IF(ISBLANK('Table'[column3]),"not complete","completed")

(3) We can create a measure. 

Measure 2 = 
var _a=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_1]="completed"))
var _b=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_2]="completed"))
var _c=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_3]="completed"))
var _d=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_1]="not complete"))
var _e=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_2]="not complete"))
var _f=COUNTROWS(FILTER(ALL('Table'),'Table'[Column_3]="not complete"))
return IF(MAX('Table'[Column_1])="completed",DIVIDE(_a+_b+_c,_a+_b+_c+_d+_e+_f),DIVIDE(_d+_e+_f,_a+_b+_c+_d+_e+_f))

(4) Then the result is as follows.

vtangjiemsft_1-1704879408524.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

amitchandak
Super User
Super User

@jriden37 , Create a date table, Join all three columns with date of date table, one join will be active others will be inactive. Use userealtionship to active the join in a measure

 

example

 

calculate( SUM(Sales[Sales Amount]),USERELATIONSHIP ('Sales'[CreateDate], 'Date'[Date]))

 

 

Use date from date table on visual

 

refer examples

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.