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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
fabo
Advocate III
Advocate III

Interaction between date slicer and line chart

Hi everyone.

I need a line chart to be responsive when one date is selected from a date slicer.  For example, if the selected date is december 31st, 2019, line chart should look like:

Anotación 2019-10-03 171911.png

But, if I change the date to may 31st, 2019, line chart should be:Anotación 2019-10-03 1721.png

I was able to get this done but I'm not really sure if my approach is good.  Maybe there is a better one, more efficient.  So please I need your comments and suggestions.

 

My approach

The model:

Anotación 2019-10-03 174311.png

 

As you can see I created a disconnected table for the date slicer.  The measures I used are:

Selected Date = // Get what date is selected from the slicer
  SELECTEDVALUE(Date_Slicer[Date]) 
Total Qty = // Measure to be used in any chart except the line chart
  CALCULATE(
    SUM(Fact_Table[Qty])
  )
 Total Qty Line Chart = // Measure to be used only in the line chart
  CALCULATE(
    [Total Qty];
    FILTER(
      ALL('Date'[Date]);
      'Date'[Date] <= [Selected Date]
    )
  )
What do you think, guys?  Is it a good approach?  Can you figure out a better solution?
 
Fabo.
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @fabo ,

 

This is a good approach, however you can also try one of other two options to not make another unrelated table:

  • Make the slicer a Before or a Between slicer and that will return the values based on that selection
  • Ohter option is to make the relationship between Date and Fact Table disable and the making use of the USERELATIONSHIP function create the measure that need the active relationship between both tables and use the same function as you have but with only one date table.

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @fabo ,

 

This is a good approach, however you can also try one of other two options to not make another unrelated table:

  • Make the slicer a Before or a Between slicer and that will return the values based on that selection
  • Ohter option is to make the relationship between Date and Fact Table disable and the making use of the USERELATIONSHIP function create the measure that need the active relationship between both tables and use the same function as you have but with only one date table.

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix .

I really appreciate your comments.  Both options are better, and the second one fits exactly to what I need.  I will definetly use it in my reports.

Thank you so much!

Smiley Very Happy

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.