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
Durga5prasad96
Regular Visitor

Need help in writing Dax functions for week on week growth & Running 3 weeks

I have two columns one is reporting week column and result value.
Here in reporting week column the data is like below 

1. 4/1/2023

2. 3/25/2023

3. 3/18/2023 like goes on with a week dates.. 

another column contains numeric values.

so my problem is i was unable to make this reporting week as hierarchy to get day, year,week or even i do not have a seperate date column aswell to achieve above measures. 
Need hlep in achieving above calculations 

 

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

Hi @Durga5prasad96 ,

Do you want to get a rolling values over the reporting week? If yes, you can create a measure as below. Please find the details in the attachment.

 

Measure = 
CALCULATE (
    SUM ( 'Table'[result value] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[reporting week] <= SELECTEDVALUE ( 'Table'[reporting week] )
    )
)

vyiruanmsft_0-1680490296925.png

 

If the above one can't help you get the expected result, could you please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

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

4 REPLIES 4
Prasad54
Frequent Visitor

hello @v-yiruan-msft  This is my table i was unable to update it so just took a screenshot of it 

Prasad54_0-1680594872960.png

 

Prasad54
Frequent Visitor

Hello @v-yiruan-msft 
First of all Thank you for your response on this.
The above calculation is giving the rolling week values like from low to high, But in my calculation it might be negative or high as we are comapring with previous weeks. Sample DataSample Datarequired dax functionrequired dax function However i need dax calculation for Rolling 3 weeks Average growth & Week over week growth % for above data 

I have 3 columns in my table as you create a sample pbix 
1. Reporting week 
2. Result value 
3. store name 
4. city
Based on above three columns we need to get the above 2 calculations ( Rolling 3 weeks Average Growth & Week over Week Growth) 
So iam attaching the pbix where i have entered sample data in table2. So here we should calculate above functions based on stores 
for example : for Adidas week over week growth % value we should show( by using reporting week and result column )  like wise.. also Rooling 3weeks growth % . 
So attached sample table and required so please look into it and help me 

Thank you 



Hi @Prasad54 ,

I didn't find the attached table, could you please paste the data in your post directly? Or you can refer the following link to upload your sample pbix file to the community. Thank you.

How to upload PBI in Community

 

In addition, you can refer the following threads to get the Rolling 3 weeks Average Growth & Week over Week Growth:

Rolling x weeks average:

Rolling 5 weeks average

Week over Week Growth %:

Week over Week Comparison

Week over week growth percent =
VAR _cwvalue =
    SUM ( Table[Sales] )
VAR _pwvalue =
    CALCULATE (
        SUM ( Table[Sales] ),
        FILTER (
            ALL ( Table ),
            Table[Year] = MAX ( Table[Year] )
                && Table[WeekNumber]
                    = MAX ( Table[WeekNumber] ) - 1
                && Table[WeekDay] = MAX ( Table[WeekDay] )
        )
    )
RETURN
    DIVIDE ( _cwvalue - _pwvalue, _pwvalue )

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.
v-yiruan-msft
Community Support
Community Support

Hi @Durga5prasad96 ,

Do you want to get a rolling values over the reporting week? If yes, you can create a measure as below. Please find the details in the attachment.

 

Measure = 
CALCULATE (
    SUM ( 'Table'[result value] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[reporting week] <= SELECTEDVALUE ( 'Table'[reporting week] )
    )
)

vyiruanmsft_0-1680490296925.png

 

If the above one can't help you get the expected result, could you please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

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.