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
StanTheMan
Frequent Visitor

How do i create a barchart with active rows?

Hi guys,

I'm struggling with creating a barchart visualization in which active rows per month are shown. It seems to me like this is such a simple question but i can't seem to get my head arround it.

I have a dataset that looks like this. (can't share the real one because of privacy)

OrdernumberClientnumberStart DateEnd Date
1131-12-2018 
211-12-201831-12-2018
2328-1-20198-2-2019
331-1-201928-2-2019
1431-1-2019 


Getting the correct numbers for a single month or period could be achieved with using a filter or some dax:
Active in Jan 2019 = IF([Start_date].[Date] <= 31-1-2019 && [End_date].[Date] >= 1-1-2019 || [Start_date].[Date] <= 31-1-2019 && ISBLANK([End_date].[date]); 1; null)

I want to create a barchart for the whole year that visualises how many clients or orders were active per month.
So if I use the dataset from above it would look something like this.

Active clients:
      3                  3                   2
Jan 2019,   Feb 2019,     Mar 2019,  Etc.

Active orders:
      4                 4                    2
Jan 2019,   Feb 2019,     Mar 2019,  Etc.

I hope I have described the problem well enough and am curious if someone has a clever solution for this.
Thanks in advance,
Stan

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

That's actually a decpetively tricky problem, but a solved one. Take a look at these two Quick Measures as I think you want something like them.

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

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @StanTheMan,

 

What about modifing your fomula like below? Table is the another calendar table.

 

Column = 
VAR start_date =
    STARTOFMONTH ( 'Table'[Date] )
VAR end_date =
    ENDOFMONTH ( 'Table'[Date] )
RETURN
    IF (
        [Start Date].[Date] <= end_date
            && 'Table1'[End Date].[Date] >= start_date
            || 'Table1'[Start Date].[Date] <= end_date
                && ISBLANK ( 'Table1'[End Date].[Date] ),
        1,
        BLANK ()
    )

Then you could count the column=1 for each month.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

That's actually a decpetively tricky problem, but a solved one. Take a look at these two Quick Measures as I think you want something like them.

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.