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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JoeCrozier
Helper II
Helper II

Display Card with date range from selected slicer

I think I need to do exactly this solution from this question, but honestly I just need it explained a bit more. 

 

More detail:

I have these slicers on one tab of my Power bi:

JoeCrozier_0-1663779448028.png

 

And on the second tab of my report, whatever you selected in those slicers will show up in cards:

JoeCrozier_1-1663779529717.png

 

The top two slicers show up great (Subject Status and Study Site).  The way I created those was I created measures that were like:  

"SelectedStatus = SELECTEDVALUE(Staff[Subject's Status])"
and then I popped those measures into a card.  Works great!
 
But for the date slicers, those come from 'between' date range slicers, and I cant figure out how to put those into a measure/card.
 
The solution in that linked question above was:
"Drag date from a CALENDAR table and use MIN and MAX to add a measure."
 
Could someone explain that to me?  What calendar table?  How would I drag it? 

 

 

 

1 ACCEPTED SOLUTION

@JoeCrozier Oh, for that I would just use this:

Measure = 
  VAR __MaxStatus = MAX('Staff'[Status Date])
  VAR __MinStatus = MIN('Staff'[Status Date])
RETURN
  __MinStatus & " - " & __MaxStatus

@ 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

5 REPLIES 5
ara0530
Advocate I
Advocate I

worked for me   thanks @Greg_Deckler 

Greg_Deckler
Super User
Super User

@JoeCrozier So let's say you have a single table, you could do this:

Measure = 
  VAR __MaxStatus = MAX('Table'[Status Date])
  VAR __MinStatus = MIN('Table'[Status Date])
  VAR __MaxBlue = MAX('Table'[Blue 'Planned' Visit Date])
  VAR __MinBlue = MIN('Table'[Blue 'Planned' Visit Date])
  VAR __Table = 
    FILTER(
      'Table',
      ( [Status Date] >= __MinStatus && [Status Date] <= __MaxStatus ) &&
      ( [Blue 'Planned' Visit Date] >= __MinBlue && [Blue 'Planned' Visit Date] <= __MaxBlue )
    )
RETURN
  SUMX(__Table,[Value])

Use that in your Card visual. That said, if it is really a single table then it should already filter the cards and you could simply do this:

Measure = SUM('Table'[Value])

or

Measure = SUMX('Table',[Value])

The last Measure has the advantage that you could do a CONCATENATEX for example if you want to return multiple values (because multiple rows are in context).


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

@Greg_Deckler Thank you!   So just to make sure I understand, lets say I have this selected in the slicer on the first page:

JoeCrozier_0-1663784120053.png

And I create a measure that looks like this:

JoeCrozier_1-1663784156327.png

 

And I put that measure on this card:

JoeCrozier_2-1663784187120.png

 

I would expect/hope for that card to say:

"4/18/2010 - 8/20/2018"

But it doesn't.  Clearly I'm doing something wrong or didn't communicate it well.  Can you spot what I did?

@JoeCrozier Oh, for that I would just use this:

Measure = 
  VAR __MaxStatus = MAX('Staff'[Status Date])
  VAR __MinStatus = MIN('Staff'[Status Date])
RETURN
  __MinStatus & " - " & __MaxStatus

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

@Greg_Deckler 

Im sorry to keep drawing you back in (and I really really appreciate all the help!) but it still seems to not be working:

JoeCrozier_0-1663787625338.png

JoeCrozier_1-1663787733825.png

 

Any ideas?

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.