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

Last sale Date Period

Dear PBI Support Team,

 

I would like to calculate only the Total sales base on Last Sales Date Data as below, please advice me with DAX. I want to calculate Total Sale From Jan - June , current Date is August. This video has the direction but not all https://www.youtube.com/watch?v=WBddNp_25YY 

 

PBI table.png

Thanks you all,

ECOBHV

6 REPLIES 6
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @ECOBHV ,

Have you solved your problem?

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please feel free to ask.

Best  Regards,

Cherry

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

Dear V-piga-msft,

 

Thank you for your support. In your DAX, I would like to replace number "6" by the max month of current year in my sales data ( June 2019). In the future, when I add more data (July 2019, August 2019), your DAX will automatically re-calculated.

 

Thanks and best regards,

Hi @ECOBHV ,

For your requirement, you could replace the "6" to Month(Today()) and have a try.

If you still need help, please share some data sample and your desired output.

Best Regards

Cherry

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

Hi  ,

 

BI DAX.png

Month(today()) will return "11" while I want to perform Month(LastDate(Table'[Column]) that now still "6" because the last date in my database is 30 Jun 2019.

 

Please see my attachment

 

Thank you so much for your supports

 

Dear v-piga-msft,

 

If I replace the "6" to Month(Today()), Year 2018 will show July, August and September. I want to show the max month of the max year in my sales data (but not max month of current date) that is now Jun and maybe July when I add more data.

 

Thanks and best regards,

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @ECOBHV ,

I'm a little confused about your requirement.

Do you want to get the total Sale From Jan - June for each year or the current year?

In addition, do you want to calculate the total sale until the current month?

For example, if you have the sales in June and August for year 2019, do you want to calculate the total saled from Jan-Aug or just Jan - June?

I have made an example if you want to calculate the sales from Jan - June for each year, please refer to the formula below.

sale_jan_jue =
CALCULATE (
    SUM ( 'table'[Revenue] ),
    FILTER (
        'table',
        YEAR ( 'table'[Date] ) = YEAR ( MAX ( 'table'[Date] ) )
            && MONTH ( 'table'[Date] ) <= 6
    )
)

Here is the output.

Capture.PNG

 

Hope this can help you.

If you still need help, please share your desired output so that we could understand your requirement better.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
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.