cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
payal4 Member
Member

Last 10 days stock in a line chart that changes dynamically with the month filter

Hi all,

 

I have to show a trend chart of last 10 days of stock that should change with selection of the month filter.

For eg: if july is selected then i have to show the last 10 days of july's stock data.

 

Can this be done?

 

 

22 REPLIES 22
tex628 Super Contributor
Super Contributor

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

I would do something like this,

Measure =
VAR maxDate = MAX(Calendar[Date])
VAR maxMonth = MONTH(maxDate) 
VAR minDate = maxDate -10
Return
CALCULATE(
[Amount],
All(calendar),
Calendar[Date]=<maxDate,
Calendar[Date]=>minDate,
Calendar[Month]=maxMonth
)
payal4 Member
Member

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

Hi @tex628 ,

 

Thanks for the reply.

I'am still not able to show the last 10 days though. The chart shows me all 30 days of the month.

tex628 Super Contributor
Super Contributor

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

That sounds strange, could you possibly provide a picture of the chart and measure?

Osmanakgunduz Frequent Visitor
Frequent Visitor

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

Hello Payal4;

 

can you create a calculated column in your date table like this? after that, use this measure as a filter and select "1". it will filter the last 10 days of the month.

measure= IF((DimDate[DayNumberOfMonth])-(MAX(DimDate[DayNumberOfMonth])-10)>0;1;0)

 

payal4 Member
Member

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

Hi @Osmanakgunduz

 

What calculated column should we used?

Osmanakgunduz Frequent Visitor
Frequent Visitor

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

Hello @payal4 

as I mentioned, the formula is:

 

Column= IF((DimDate[DayNumberOfMonth])-(MAX(DimDate[DayNumberOfMonth])-10)>0;1;0)

Best Regards.

 

Osmanakgunduz Frequent Visitor
Frequent Visitor

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

Hello Payal4,

 

in addition, to use this formula, you must have a column in your date table that contains day number of the month.

 

Screenshot_1.png

payal4 Member
Member

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

@Osmanakgunduz 

I do no have a gregarion calender. Hence, need to calculate the day number of month.

payal4 Member
Member

Re: Last 10 days stock in a line chart that changes dynamically with the month filter

Hi @Osmanakgunduz 

Is there a way to do this without the day number of year as I do not have the usual calender and have 445 calender? I would have to create a column with day number of year that would again require some logic. I have less time to do the same.

Please help

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)