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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
arpost
Advocate V
Advocate V

Is it possible to set dates used in a visual to min of a date?

I have a unique scenario and am hoping someone can help me with it. I am wanting to track values of data over time but annotate when certain percentages changed with what would be the equivalent of a dynamic "constant" line. Here's a mock verson of the data:

Values

DateCategoryValue
1/1/2014New$10,000
1/2/2014Returning$25,000

 

Change Event

DatePercentage
1/1/201364.5%
6/1/201465.5%

I've "hacked" this in my report by using a Line and clustered column chart with the Values set to the Line portion and the percentage change events as Column values, which currently appear as follows:

arpost_0-1626444717396.png

This works well enough, but I am hitting a roadblock when the Date of the change event pre-dates the start of the data; in this example, the data may start in 2014, but the change event from 2013 is still showing:

arpost_1-1626444850757.png

Anyone have some clever thoughts on how I might go about making it so this visual only shows data that starts when the line values start?

1 ACCEPTED SOLUTION

OK, then maybe something like this:

 

_yourPercentageMeasure = 
VAR __maxDate =
CALCULATE(
    MAX(changeEvent[Date]),
    ALL(changeEvent)
)
RETURN
CALCULATE(
    MAX(changeEvent[Percentage]),
    FILTER(
        changeEvent,
        changeEvent[Date] = __maxDate
    )
)

 

 

I'm assuming here that your changeEvent table is related to your calendar table from which the shared date axis comes.

 

I seem to get the required output (I had to change the dates to fit with my calendar)

BA_Pete_0-1626450365381.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

6 REPLIES 6
BA_Pete
Super User
Super User

Hi @arpost ,

 

I'm probably oversimplifying this, but have you tried something like this?

_yourPercentageMeasure =
IF(
  ISBLANK([yourLineValueMeasure]),
  BLANK(),
  [yourPercentageValueMeasure]
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




@BA_Pete, thanks for posting. I just tried your suggestion but couldn't get it to work. These values are all just base fields, so no measures. When I attempted to convert to using measures with the ISBLANK logic, all change event columns disappeared because there was no overlap between the date of the % change and the date of values entered. I've got the visual configured as such:

arpost_0-1626447078889.png

 

Ok, so I guess more like this:

_yourPercentageMeasure =
IF(
  ISBLANK( SUM(yourTable[Value 1]) + SUM(yourTable[Value 2]) ),
  BLANK(),
  SELECTEDVALUE(yourTable[Fee Change])
)

 

I'm not sure if SELECTEDVALUE will work in your scenario, so feel free to swap this for MAX or MIN or similar.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Thanks for that, @BA_Pete. Sadly, no joy. 
Measure:

arpost_3-1626448221626.png

 

Result:

arpost_0-1626447803785.png

I did a little auditing and confirmed that the values in question don't have entries for specific dates. Using a table, I selected a % Change Date, which filtered to $0 for the Values because there were no values entered on 6/20/19.

 

arpost_2-1626447953335.png

 

OK, then maybe something like this:

 

_yourPercentageMeasure = 
VAR __maxDate =
CALCULATE(
    MAX(changeEvent[Date]),
    ALL(changeEvent)
)
RETURN
CALCULATE(
    MAX(changeEvent[Percentage]),
    FILTER(
        changeEvent,
        changeEvent[Date] = __maxDate
    )
)

 

 

I'm assuming here that your changeEvent table is related to your calendar table from which the shared date axis comes.

 

I seem to get the required output (I had to change the dates to fit with my calendar)

BA_Pete_0-1626450365381.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




That did it, @BA_Pete! I had to make some edits to make it start with the MIN date (and will probably need to make more for the max), but it is now performing as expected:

arpost_0-1626450667511.png

 

Here is a sanitized version of the code:

 

Percentage Change = 
VAR minDate =
CALCULATE(
MIN(Values[Date]),
ALL(Values)
)
RETURN
CALCULATE(
MAX('Change Event'[Percentage]),
FILTER(
'Change Event',
'Change Event'[Date] >= minDate
)
)

 


Thanks again; you're the best.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors