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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.