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
shaykoooo
Helper I
Helper I

Running Total?!

Hi,

I am trying to build a DAX expression to help me check, for each of the following months- 10/2017 through 09/2018 if there was sales ofat least one USD in the previos 12 months. For example, for 10/2017, the expression checks month 10/2016 till 09/2017. Also, the the formula shold check if there are sales on the month evaluated (10/2017 in this example).

 

TY!

 

 

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

Hi @shaykoooo

 

Try measures as below

previos 12 months =
CALCULATE (
    SUM ( Sheet3[sale] ),
    FILTER (
        ALL ( Sheet3 ),
        DATEDIFF ( [date], MAX ( [date] ), MONTH ) >= 1
            && DATEDIFF ( [date], MAX ( [date] ), MONTH ) <= 12
    )
)

check if sales currentmonth = IF(MAX([sale])>0,1,0)

formula to check = IF([check if sales currentmonth]>0||[previos 12 months]>0,"has slaes")

 

 5.png

Please note that, since i don't know what exactly about your dataset, i use "year/month/1" to refer to each month of a year.

If you have multiple dates for each month, you could sum sales for each month, then apply with measures above.

 

 

Best Regards

maggie

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @shaykoooo

 

Try measures as below

previos 12 months =
CALCULATE (
    SUM ( Sheet3[sale] ),
    FILTER (
        ALL ( Sheet3 ),
        DATEDIFF ( [date], MAX ( [date] ), MONTH ) >= 1
            && DATEDIFF ( [date], MAX ( [date] ), MONTH ) <= 12
    )
)

check if sales currentmonth = IF(MAX([sale])>0,1,0)

formula to check = IF([check if sales currentmonth]>0||[previos 12 months]>0,"has slaes")

 

 5.png

Please note that, since i don't know what exactly about your dataset, i use "year/month/1" to refer to each month of a year.

If you have multiple dates for each month, you could sum sales for each month, then apply with measures above.

 

 

Best Regards

maggie

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