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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MauroBote
Helper I
Helper I

Relating date Slicer with a Calendar Date Line Chart

Hi friends.

 

I have a Calendar Table (CALENDARIO) created with the min and max of 2 columns dates ([Plan Date] and [Real Date]) from another table (HITOS), and I use it for the X axis of a Line Chart. Also I have a date Slicer (between) created with the column [Plan Date] from the same table used before (HITOS).

 

On the model, I have determined 2 diferent relationship between the 2 tables:

  • HITOS[Plan Date] with CALENDARIO[Date]
  • HITOS[Real Date] with CALENDARIO[Date]

Both relationships are inactives.

 

So, I need a way to change the X axis of the Line Chart with the dates selected on the Slicer.

 

Now I have this result:

As Is.png

 

And I need this one (I have change the date filter manually):

To Be.png

 

The model:

Model.png

 

Can anyone help me please?

 

Thanks!

1 ACCEPTED SOLUTION

hi  @MauroBote 

Just the adjust the two measure as below:

PLAN AC =
CALCULATE(
SUM(HITOS[PESO]),
USERELATIONSHIP(CALENDARIO[Date],HITOS[FECHA PLAN]),FILTER(
ALLSELECTED(CALENDARIO[Date]),MAX(CALENDARIO[Date])<=MAX(HITOS[FECHA PLAN])&&
ISONORAFTER(CALENDARIO[Date], MAX(CALENDARIO[Date]), DESC)
)
)/HITOS[Total % PESO]

 

REAL AC =
IF(max(CALENDARIO[Date])>today(),"",CALCULATE(
    SUM(HITOS[AVANCE REAL]),
    USERELATIONSHIP(CALENDARIO[Date],HITOS[FECHA REAL 2]),HITOS[FECHA REAL 2]<>BLANK(),FILTER(
        ALLSELECTED(CALENDARIO[Date]),
        ISONORAFTER(CALENDARIO[Date], MAX(CALENDARIO[Date]), DESC)
    )
)/HITOS[Total % PESO])

 

Result:

 

1.JPG

 

Regards,

Lin

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

View solution in original post

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi  @MauroBote 

You need to just make some changes in the formula of the two measure.

Please share your sample pbix file for us to have a test, that will be a great help.

 

Regards,

Lin

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

hi  @MauroBote 

Just the adjust the two measure as below:

PLAN AC =
CALCULATE(
SUM(HITOS[PESO]),
USERELATIONSHIP(CALENDARIO[Date],HITOS[FECHA PLAN]),FILTER(
ALLSELECTED(CALENDARIO[Date]),MAX(CALENDARIO[Date])<=MAX(HITOS[FECHA PLAN])&&
ISONORAFTER(CALENDARIO[Date], MAX(CALENDARIO[Date]), DESC)
)
)/HITOS[Total % PESO]

 

REAL AC =
IF(max(CALENDARIO[Date])>today(),"",CALCULATE(
    SUM(HITOS[AVANCE REAL]),
    USERELATIONSHIP(CALENDARIO[Date],HITOS[FECHA REAL 2]),HITOS[FECHA REAL 2]<>BLANK(),FILTER(
        ALLSELECTED(CALENDARIO[Date]),
        ISONORAFTER(CALENDARIO[Date], MAX(CALENDARIO[Date]), DESC)
    )
)/HITOS[Total % PESO])

 

Result:

 

1.JPG

 

Regards,

Lin

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

Thank you so much Lin. You are a genius!!!

amitchandak
Super User
Super User

@MauroBote 

REfer

plan =
var _min = minx(CALENDARIO,CALENDARIO[Date])
return
calculate(sum(HITOS[Plan Value]),filter(CALENDARIO,CALENDARIO[Date]>=_min &&CALENDARIO[Date]<=max(CALENDARIO[Date]))
,userelation(HITOS[Plan Date] , CALENDARIO[Date]))


actual =
var _min = minx(CALENDARIO,CALENDARIO[Date])
return
calculate(sum(HITOS[Real Value]),filter(CALENDARIO,CALENDARIO[Date]>=_min &&CALENDARIO[Date]<=max(CALENDARIO[Date]))
userelation(HITOS[Real Date] , CALENDARIO[Date]))
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
Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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