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
bklyn3
Advocate II
Advocate II

filling up a date table with an aggregated value per catergory

Hello

 

I have a table with transaction date (not consecutive and not unique), client name and sales

 

DateClient Future Sales

01/01/2022

A$50,000
01/01/2022A$18,008
01/04/2022B$30,000
01/07/2022A$49,000
01/10/2022B$78,000

 

I would like to create a new table that shows me how much each client plan on spending in the next 8 weeks. 

> The new table should have one date for each days in hte next 8 weeks. 

> If a client doesnt' plan on spending on specific day, the reported number should be the last reported amount (initial value is $0) 

> if a client spend more than once on a given day, it should be the sum for the day.  

 

How do I achieve that in DAX? 

 

thank you

 

 

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

Hi @bklyn3 ,

According to your description, You want to generate a new table that displays the date of each customer from today to the eighth week, and sums the time corresponding to the [Future Sales] field (0 if there is no data), and [Future Sales] Fields may be empty or duplicate..Right?

(1)This is my test data:

yingyinr_0-1662101985704.png

 

(2) We can click New Table and enter :

Table2 =
ADDCOLUMNS (
    CROSSJOIN ( VALUES ( 'Test'[Client] ), CALENDAR ( TODAY (), TODAY () + 56 ) ),
    "Feture Salse",
        CALCULATE (
            SUM ( 'Test'[Future Sales] ),
            TREATAS ( { ( [Client], [Date] ) }, Test[Client], Test[Date] )
        )
)

(3) Then we can meet your need, the result is as follows:

yingyinr_1-1662101985719.png

 

If this method does not meet your needs, can you provide us with detailed input and output sample data in tabular form so that we can better solve the problem for you.

 

Best Regards

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

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @bklyn3 ,

According to your description, You want to generate a new table that displays the date of each customer from today to the eighth week, and sums the time corresponding to the [Future Sales] field (0 if there is no data), and [Future Sales] Fields may be empty or duplicate..Right?

(1)This is my test data:

yingyinr_0-1662101985704.png

 

(2) We can click New Table and enter :

Table2 =
ADDCOLUMNS (
    CROSSJOIN ( VALUES ( 'Test'[Client] ), CALENDAR ( TODAY (), TODAY () + 56 ) ),
    "Feture Salse",
        CALCULATE (
            SUM ( 'Test'[Future Sales] ),
            TREATAS ( { ( [Client], [Date] ) }, Test[Client], Test[Date] )
        )
)

(3) Then we can meet your need, the result is as follows:

yingyinr_1-1662101985719.png

 

If this method does not meet your needs, can you provide us with detailed input and output sample data in tabular form so that we can better solve the problem for you.

 

Best Regards

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

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.

Top Solution Authors