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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
db042190
Responsive Resident
Responsive Resident

how can i choose a plot visual's date axis time interval at run time?

Hi , can someone direct me in making the right hand visual below smarter?

 

I already have page level filters on date range, exchange , sector and ticker.  It seems that a user might decide when sitting down that weekly or monthly or yearly intervals would be more interesting than daily.  And of course the last data point in an interval would be the best one to choose ie May 1 thru one day before the last biz day in May would be irrelevant in a monthly view.  Maybe except for current month.

 

makedateaxissmarter.png

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Consider creating a date table and using the date-heirarchy to easily switch between daily, weekly and yearly view: https://radacad.com/what-a-power-bi-hierarchy-is-and-how-to-use-it
If you need weekly date ranges, then you'll also need to create a calculated column and also custom date heirarchy.

View solution in original post

4 REPLIES 4
db042190
Responsive Resident
Responsive Resident

thx vicky i dont think that will work.  not sure though.

 

below is a picture of a pasted copy i made of that visual onto a different page.  Instead of date I now have the built in pbi date hierarchy on the x axis.  Unfortunately , because there is no option to summarize close as "last" this doesnt work.  Right now i think what you are seeing is a sum of the entire year after i drilled up.   Average , count etc dont make sense.  I dont think a measure would make sense because thats one value for the entire dataset.  But i'm thinking maybe if calculated columns are more flexible than i thought, maybe that one context dax function that asks "am i currently summarized on x" can be used to get the last close value of the part of the date hierarchy I'm in at this moment.   My gut says no, but maybe someone can offer some advice here.

 

datehierarchydoesntwork.png

db042190
Responsive Resident
Responsive Resident

here is a post on getting last value.  I'm going to play with one of these examples as an additional column.  I dont think a measure makes sense (because there is only one per datset i thought) but i'll play with that too.  https://community.fabric.microsoft.com/t5/Desktop/How-to-create-a-measure-to-find-the-last-value-of-... 

db042190
Responsive Resident
Responsive Resident

i incorporated this measure into the picture and it seems to do the trick.  It seems limited in scope to ticker and date but thats ok for my purposes.  I was pleasantly surprised to see the title change automatically.  Thx Vicky.

 

Latest Value =
CALCULATE (
MAX ( 'data'[Close] ),
FILTER (
ALLEXCEPT ( 'data', 'data'[Ticker] ),
'data'[Date] = MAX ( 'data'[Date] )
)
)

 

andnowhierarchydoeswork.png

 

 

vicky_
Super User
Super User

Consider creating a date table and using the date-heirarchy to easily switch between daily, weekly and yearly view: https://radacad.com/what-a-power-bi-hierarchy-is-and-how-to-use-it
If you need weekly date ranges, then you'll also need to create a calculated column and also custom date heirarchy.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.