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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PTIFANOU
Regular Visitor

Creating a chart with 2 dates to comapre entry and exit

Hi all, I am a complete newbe to PowerBI.

I have a table with 3 columns, the first one is "id file" each name is different, the second is the date of creation for each of this files,the third one is the date of cloture.

i'd like to make a bar chart that shows by month the number of files created (one bar) and the number of files finished (second bar)

thanks, and sorry for my english

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@PTIFANOU OK:

  • Create a disconnected table for your months (no relationship) using an Enter Data query to just enter your month names in one column and the month number of the year (1...12) in the other column. Let's assume that you call this table "Months" and the columns are "Month" and "MonthSort" respectively
  • Set the Sort By column for the first column to be your second column
  • Create the following 2 DAX calculated columns in your table:
Creation Month = FORMAT([CreationDate],"mmmm")


Cloture Month = FORMAT([ClotureDaate],"mmmm")
  • Create the following 2 measures:
Documents Created = 
  VAR __Month = MAX('Months',[Month])
RETURN
  COUNTROWS(FILTER('Table',[Creation Month] = __Month))


Documents Cloture = 
  VAR __Month = MAX('Months',[Month])
RETURN
  COUNTROWS(FILTER('Table',[Cloture Month] = __Month))
  • Create a bar chart visual
  • Place Month column from your Months table into the X-axis field well
  • Place the two measures into the Y-axis field well


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

I suggest having a calendar table like below.

One active relationship and one inactive relationship.

And then use USERELATIONSHIP dax function when using inactive relationship.

 

Jihwan_Kim_1-1664724401186.png

 

 

Jihwan_Kim_0-1664724390766.png

 

Start count: =
COUNTROWS( Data )
 
End count =
CALCULATE( [Start count:],
    USERELATIONSHIP('Calendar'[Date], Data[EndDate])
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I suggest having a calendar table like below.

One active relationship and one inactive relationship.

And then use USERELATIONSHIP dax function when using inactive relationship.

 

Jihwan_Kim_1-1664724401186.png

 

 

Jihwan_Kim_0-1664724390766.png

 

Start count: =
COUNTROWS( Data )
 
End count =
CALCULATE( [Start count:],
    USERELATIONSHIP('Calendar'[Date], Data[EndDate])
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Greg_Deckler
Community Champion
Community Champion

@PTIFANOU OK:

  • Create a disconnected table for your months (no relationship) using an Enter Data query to just enter your month names in one column and the month number of the year (1...12) in the other column. Let's assume that you call this table "Months" and the columns are "Month" and "MonthSort" respectively
  • Set the Sort By column for the first column to be your second column
  • Create the following 2 DAX calculated columns in your table:
Creation Month = FORMAT([CreationDate],"mmmm")


Cloture Month = FORMAT([ClotureDaate],"mmmm")
  • Create the following 2 measures:
Documents Created = 
  VAR __Month = MAX('Months',[Month])
RETURN
  COUNTROWS(FILTER('Table',[Creation Month] = __Month))


Documents Cloture = 
  VAR __Month = MAX('Months',[Month])
RETURN
  COUNTROWS(FILTER('Table',[Cloture Month] = __Month))
  • Create a bar chart visual
  • Place Month column from your Months table into the X-axis field well
  • Place the two measures into the Y-axis field well


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

thanks a lot both of yours solutions works perfectly

thanks fotr ur time and efforts

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors