cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Trend between two selectionned dates

Hello !

 

I am struggling with a function i want to create. my objective is to create an indicactor which shows the trend between two selectionned dates. Thoses dates are selectionned by the user using a slicer.

 

As an exemple :
My table has 3 columns : Article Name - Date of sale (only the first day of each month as 01.01.18 or 02.01.2018.....) - Quantity
First case :
The user select April - May - June - July using a slicer
Second case :
The user select only April - September

What i want to do, is to show the trend (Just a number not a line) for both of selections.
Hence, it is a dynamic trend.

 

I don't know if it is possible to use selections of user and work with it, but it could be really useful

 

Thank you !

 

 

Nabil

1 ACCEPTED SOLUTION

Accepted Solutions
v-yulgu-msft Super Contributor
Super Contributor

Re: Trend between two selectionned dates

Hi @Anonymous,

 

Please refer to below measure:

trend =
VAR firstdatevalue =
    CALCULATE (
        SUM ( Sample2[Quantity] ),
        FILTER ( Sample2, Sample2[Date] = MIN ( Sample2[Date] ) )
    )
VAR lastdatevalue =
    CALCULATE (
        SUM ( Sample2[Quantity] ),
        FILTER ( Sample2, Sample2[Date] = MAX ( Sample2[Date] ) )
    )
RETURN
    DIVIDE ( lastdatevalue - firstdatevalue, firstdatevalue )

1.PNG

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

4 REPLIES 4
Omega Established Member
Established Member

Re: Trend between two selectionned dates

Can you share sample data and the expected results? 

Anonymous
Not applicable

Re: Trend between two selectionned dates

Hello,

 

Here is a sample :

Sample.PNG

 

I just simplfied the number of article, in my case there more than 1000...

 

 

Thank you!

v-yulgu-msft Super Contributor
Super Contributor

Re: Trend between two selectionned dates

Hi @Anonymous,

 

Please refer to below measure:

trend =
VAR firstdatevalue =
    CALCULATE (
        SUM ( Sample2[Quantity] ),
        FILTER ( Sample2, Sample2[Date] = MIN ( Sample2[Date] ) )
    )
VAR lastdatevalue =
    CALCULATE (
        SUM ( Sample2[Quantity] ),
        FILTER ( Sample2, Sample2[Date] = MAX ( Sample2[Date] ) )
    )
RETURN
    DIVIDE ( lastdatevalue - firstdatevalue, firstdatevalue )

1.PNG

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

Anonymous
Not applicable

Re: Trend between two selectionned dates

Hello,

 

It matchs perfectly my needs !

 

Thank you !

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 51 members 877 guests
Please welcome our newest community members: