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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
fabiolamelo
Helper II
Helper II

Bar chart in a range date (2 dif date columns) and a line with a non-compliance event (dif table)

Hi there

 

I`m working in a new report that I need to show the users when a non-compliance happens in a particular transaction .

 

To do this I have a transaction table that has 2 dates (Start transaction date and record end date) and a second separated table that show when the non-compliance happened.

 

On the previous system that were created using R languange it was possible to create a line showing the start and end date of the transaction and the red dots were when the non-compliance happened. 

 

I would like to create view, with a bar chart showing the range date ( Transaction table - start and end date) and a line chart showing when the non-compliance happens .

 

Unfortunately, this is a confidential data, and I cannot share the pbix but please following what I tried to achieve ,  the tables example and the steps that I already did:

 

Transaction Table

 

transaction

Start transaction date

End transaction date

T1

18/07/2021

17/12/2021

T2

18/07/2021

17/12/2021

 

Non-compliance  Table

 

transaction

Non -compliance date

T1

14/07/2021

T2

15/07/2021

 

On the above case I expect a graphic with a line starting on 18/07/2021 finishing on 17/12/2021 and a line mentioned that the transaction T1 had a non-compliance on 14/07/2021 and  the T2 had a non-compliance on 15/07/2021

 

I did the following steps and I still facing an issue to find a correct dax calculation :

1 – Created a calendar table where the min date is (Start transaction date – from the Transaction table) and the MAX date is (End transaction date – from the Transaction table)

2 – Create a relationship between the Calendar date with the Transaction table using the start date as INACTIVE relationship

3 – Create a relationship between the Calendar date with the Transaction table using the ends date as ACTIVE relationship

4 – Created the following dax code :The issue with this code is that I could not find a way to show the range date (start and end) because the relationship between the transaction and date tables are active just

 

Calculation

VAR LastVisibleDate = MAX (' Transaction Table [wp_sys_modified_on])

    VAR FirstVisibleDate  MIN ( Transaction Table [transaction date] )

    VAR LastDateWithTotal =

        CALCULATE (

            MAX ( 'Calendar'[Date] ),

              KEEPFILTERS(ALLSELECTED('Calendar'[Date] )  

    ))

VAR Result =

    IF (

        FirstVisibleDate <= LastDateWithTotal,

        CALCULATE (

            DISTINCTCOUNT(Transaction Table [transaction]) ,

           'Calendar'[Date] <= LastVisibleDate

        )

    )

    RETURN

Result

 

Can you please help me to create view, with a bar chart showing the range date ( Transaction table - start and end date) and a line chart showing when the issue happens .

 

Thank in advance

1 REPLY 1
amitchandak
Super User
Super User

@fabiolamelo , You can create a common date table and use that

 

https://amitchandak.medium.com/power-bi-when-i-asked-you-to-create-common-tables-a-quick-dax-solutio...

 

For start and end dates refer

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

or

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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