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

Showing a change in sales against previous time range with a changing date

Hi,

 

I want to build a report with a change to a specific time range. To do so, I have to rely on a table which gives me the name of the account and then the date where a specific action as been taken.

 

So for example I have a CSV with: 

 

Client A; 01.05.2021

Client B; 01.01.2019

Client C; 01.10.2020

 

 

In my end table I want to show the number of sales before these dates and after these dates.

 

It should look similar to this:

 

Berl21_0-1651844666498.png

 

Usual time intelligence functions won't work here. How do I solve this?

 

Thanks in advance 🙂 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Berl21 ,

 

I assum your data looks like this:

vchenwuzmsft_0-1652239250122.png

Create measures via the following code:

sales before =
SUMX (
    FILTER ( 'Table', [date] < SELECTEDVALUE ( 'special date'[special date] ) ),
    [sales]
)

sales after =
SUMX (
    FILTER ( 'Table', [date] >= SELECTEDVALUE ( 'special date'[special date] ) ),
    [sales]
)

 

Result:

vchenwuzmsft_1-1652239366687.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

3 REPLIES 3
v-chenwuz-msft
Community Support
Community Support

Hi @Berl21 ,

 

I assum your data looks like this:

vchenwuzmsft_0-1652239250122.png

Create measures via the following code:

sales before =
SUMX (
    FILTER ( 'Table', [date] < SELECTEDVALUE ( 'special date'[special date] ) ),
    [sales]
)

sales after =
SUMX (
    FILTER ( 'Table', [date] >= SELECTEDVALUE ( 'special date'[special date] ) ),
    [sales]
)

 

Result:

vchenwuzmsft_1-1652239366687.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

tamerj1
Community Champion
Community Champion

Hi @Berl21 

you may try

Sales before =
COUNTROWS (
    FILTER (
        CALCULATETABLE ( Table, ALLEXCEPT ( Table, Table[Client name] ) ),
        Table[Date] <= SELECTEDVALUE ( Table[Date] )
    )
)
Sales after =
COUNTROWS (
    FILTER (
        CALCULATETABLE ( Table, ALLEXCEPT ( Table, Table[Client name] ) ),
        Table[Date] >= SELECTEDVALUE ( Table[Date] )
    )
)

 

Arul
Impactful Individual
Impactful Individual

@Berl21 ,

 

Can you share sample sales data?

Thanks,

Arul

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors