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
huguest
Advocate II
Advocate II

Chart from two Date fields

Hello,

I want to create a bar chart that presents the count of records having a given date in two separate date fields (Date1 and Date2) with a date x-axis.  I also need to be able to filter by country and/or region.

 

Here is a sample dataset and desired chart:

 

CountryRegionDate1Date2
CanadaAmericas31-Oct-1831-Oct-18
USAAmericas31-Oct-1831-Dec-18
ChinaAsia Pacific30-Jun-1831-Jul-18
IndiaAsia Pacific30-Sep-1830-Sep-18
FranceEurope30-Sep-1831-Oct-18
GermanyEurope31-Jul-1830-Nov-18
SpainEurope30-Nov-1831-Dec-18
AustraliaAsia Pacific31-Aug-1830-Sep-18

 

chart.png

 

Researched and tried various things without success 😞

 

Thank you!

 

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

Hi huguest,

 

Click edit queries-> Transform-> click on column Date1 and Date2-> click Unpivot Columns, the result is like below:

Capture.PNG 

 

Then you can drag country column to value field, Date column as x-axis, legend column as legend.

2.PNG 

 

Regards,

Jimmy Tao

View solution in original post

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

Hi huguest,

 

Click edit queries-> Transform-> click on column Date1 and Date2-> click Unpivot Columns, the result is like below:

Capture.PNG 

 

Then you can drag country column to value field, Date column as x-axis, legend column as legend.

2.PNG 

 

Regards,

Jimmy Tao

jthomson
Solution Sage
Solution Sage

Just do some pivoting in Power Query so you've got four columns - country, region, date type and date, then make a couple of measures counting the instances of 1 and 2 in your date type column

Greg_Deckler
Super User
Super User

I'm not super clear on what you are going for here but perhaps it is similar to one of these two Quick Measures?

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365

 

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.