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
deniselias
Frequent Visitor

Date count of previous month Blank HELP

I've tried various DAX expressions and Variables, but I can't find a solution that considers counting without the blank.

I don't just want to place a segmented selection but I want it to be displayed on the card.

 

Card displayed

deniselias_0-1658067683416.png

 

I need

Previous month data that should appear on the card (in this case JUNE):

deniselias_1-1658067745372.png

Pbix file:

https://1drv.ms/u/s!Avq1zGJizBimsUCECKbCmKD7UL7g?e=yZmBqc

 

Thanks for all.

 

Regards,

Denis.

1 ACCEPTED SOLUTION

@deniselias 
Here you go https://www.dropbox.com/t/h3DOOlrfoIp3orlY

1.png

MIRO count LastMonth 2 = 
VAR SelectedDate = TODAY ( )
VAR StartOfPreviousMonth = EOMONTH ( SelectedDate, - 2 ) + 1
VAR EndOfPreviousMonth = EOMONTH ( StartOfPreviousMonth, 0 )
VAR Result =
    CALCULATE (
        COUNT ( 'P  Manual'[MIRO date] ),
        'P  Manual'[MIRO date] >= StartOfPreviousMonth,
        'P  Manual'[MIRO date] <= EndOfPreviousMonth,
        'P  Manual'[Status] = "6.1 PAYMENT RELEASED",
        REMOVEFILTERS ( 'P  Manual' )
    )
RETURN
    Result

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello @Ashish_Mathur ,

 

Thanks for this answer, it also gave me a new perspective.

Thank you so much for sharing the expertise.

 

Regards,

Denis.

You are welcome.  If my reply helped, please mark it as Answer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
tamerj1
Super User
Super User

Hi @deniselias 
I'm not sure if I correctly undesrand your requirement. However please refer to the sample file with the proposed solution https://www.dropbox.com/t/WWioOOfNgkr5JlrI

Actually this measure calculates the number of records in the previous month up to the day of today. For example today is 17th so if you select June the measure will return the count from May 1st up to May 17th. If nothing is selected it will return the same but for the month before the last month that has record in your data. In this case the last data available is for November. So it will return the count for October (by the way your data does not have records for August, September or October but strangely it has for November). However, this can be changed if you wish to refer to the current day instead for example.

Please let me know my assumptions are correct or something else that has to be done. Thank you

1.png

 

 

MIRO count LastMonth 2 = 
VAR SelectedDate = MAX ( 'P  Manual'[MIRO date] )
VAR StartOfPreviousMonth = EOMONTH ( SelectedDate, - 2 ) + 1
VAR EndOfPeriod = DATE ( YEAR ( StartOfPreviousMonth ), MONTH ( StartOfPreviousMonth ), DAY ( TODAY() ) )
VAR Result =
    CALCULATE (
        COUNT ( 'P  Manual'[MIRO date] ),
        'P  Manual'[MIRO date] >= StartOfPreviousMonth,
        'P  Manual'[MIRO date] <= EndOfPeriod,
        'P  Manual'[Status] = "6.1 PAYMENT RELEASED",
        REMOVEFILTERS ( 'P  Manual' )
    )
RETURN
    Result

 

 

Hello @tamerj1 ,

Thanks for reply, but it wasn't exactly what I needed. What I wanted is for the card to display the exact amount of postings (MIRO date count) from the previous month. Without me having to select the month.

 

Because it shows blank, I wanted it to show the count of 5523.

 

Thanks for the help ultil now.

@deniselias 
Here you go https://www.dropbox.com/t/h3DOOlrfoIp3orlY

1.png

MIRO count LastMonth 2 = 
VAR SelectedDate = TODAY ( )
VAR StartOfPreviousMonth = EOMONTH ( SelectedDate, - 2 ) + 1
VAR EndOfPreviousMonth = EOMONTH ( StartOfPreviousMonth, 0 )
VAR Result =
    CALCULATE (
        COUNT ( 'P  Manual'[MIRO date] ),
        'P  Manual'[MIRO date] >= StartOfPreviousMonth,
        'P  Manual'[MIRO date] <= EndOfPreviousMonth,
        'P  Manual'[Status] = "6.1 PAYMENT RELEASED",
        REMOVEFILTERS ( 'P  Manual' )
    )
RETURN
    Result

Thanks @tamerj1 for this incredible solution!

 

I'm very happy right now!

 

Thanks for all the help!

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.