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
Anonymous
Not applicable

Show results in nexth month

Dear pbi users,

 

I am trying to show the results of a month in the next month. Please see the screen below.

 

I am using the following formula. 

1. Nog te werken per dag (m-1) = CALCULATE([1. Nog te werken p dag],PREVIOUSMONTH(Datum[Datum]))
 
As you can see (blue arrow) this goes fine for the first month, and then the values are not correct anymore. The date value in my calculate function is also marked as the date table in my report.
 
Anyone knows whats going wrong?

 

GuusDuker_0-1596114587098.png

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Sorry for late back.

 

Please try this:

Measure =
VAR next =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Datum'[Datum] ),
            'Datum'[Datum] < MAX ( 'Datum'[Datum] )
        ),
        'Datum'[Datum]
    )
VAR t =
    ADDCOLUMNS (
        ALLSELECTED ( Datum[Datum] ),
        "Next", next,
        "A", [1. Nog te werken p dag]
    )
RETURN
    MAXX ( FILTER ( t, Datum[Datum] = [Next] ), [A] )

v-xuding-msft_1-1596524680896.png

 

 

 

Best Regards,
Xue Ding
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

13 REPLIES 13
Anonymous
Not applicable

@v-xuding-msft Did you had time to take a look at the pbix file?

 

Thanks in advance.

Hi @Anonymous ,

 

Sorry for late back.

 

Please try this:

Measure =
VAR next =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Datum'[Datum] ),
            'Datum'[Datum] < MAX ( 'Datum'[Datum] )
        ),
        'Datum'[Datum]
    )
VAR t =
    ADDCOLUMNS (
        ALLSELECTED ( Datum[Datum] ),
        "Next", next,
        "A", [1. Nog te werken p dag]
    )
RETURN
    MAXX ( FILTER ( t, Datum[Datum] = [Next] ), [A] )

v-xuding-msft_1-1596524680896.png

 

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Works perfectly, thanks a lot.

 

 

 

You're welcome. Glad it works for you.😊

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , Really strange.

Is Datanum is date table?

If not make sure date is coming from a date table that has been marked as date .

example

last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

LMTD Sales = CALCULATE(SUM(Sales[Sales Amount]),PREVIOUSMONTH('Date'[Date]))

 

If still you face the issue. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

@Anonymous does the datum column in the visual from your calendar table?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Yes, this date column is the date value from the date table. 

 

@parry2k  or @amitchandak Can one of you guys speak with me on skype so i can share my screen and show you my file?

@Anonymous I can but in an hour. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Alright, thank you. 

 

My skype name: Guus Duker, or e-mail guus.duker@bastrucks.com

 

 

Anonymous
Not applicable

@parry2k @amitchandak, Today is possible for you?

 

Thanks in advance.

Hi @Anonymous ,

 

You could try this firstly:

Measure =
VAR next =
    MAXX (
        FILTER ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] < MAX ( 'Table'[Date] ) ),
        'Table'[Date]
    )
RETURN
    CALCULATE ( [1. Nog te werken p dag], 'Table'[Date] = next )

 

If it can't help, please share a dummy pbix file with us. Then we can test. (For CSS team, it is prohibited to use the personal contact to help customers.)

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
parry2k
Super User
Super User

@Anonymous formula looks correct, wondering what is the measure expression.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k the measure is:

 

1. Nog te werken p dag = DIVIDE([1. Uren gewerkt (Over)],[1. Werkbare dagen (Over)])
 
So its a divide function for the columns in front.

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.