Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Sameperiodlastyear giving (Blank) counts while applying filter

Hi All,

 

I have created 2 measures -

1) YTD Counts - which shows activity counts for currect year (2022)

YTD Activity = TOTALYTD(COUNT('Activity Details'[Activity Id]),DATESYTD('Activity details'[Activity Submission Date and time]))

 

2) YTD Counts for Last Year - which shoes activity counts for last year 

YTD Activity LY = CALCULATE([YTD Activity],SAMEPERIODLASTYEAR('Activity details'[Activity Submission Date and time]))
 
Now, I have some filters also in my dashboard throgh which I can do slicing and dicing of my KPIs. But, when I am appling any filter then Last year counts are returning (Blank) counts.

And due to this, my another measure is giving Infinity counts on Card KPI.
YTD Activity Incr. = ([YTD Activity]-[YTD Activity LY])/[YTD Activity LY]
 
Kindly help me to resolve issue that if I select any value from filter then last year counts should be filtered as per filter, which is giving (Blank) result.
 
Thanks!!!
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could create a mesure to calculate count.

Count = 
IF (
    MONTH ( MAX ( [Activity Submission Date and time] ) ) = MONTH ( TODAY () ),
    CALCULATE (
        COUNT ( [Activity Id] ),
        FILTER (
            'Activity details',
            [Activity Submission Date and time]
                <= DATE ( YEAR ( [Activity Submission Date and time] ), MONTH ( TODAY () ), DAY ( TODAY () ) ))),
    COUNT ( [Activity Id] ))

and Percentage as follows:

Percentage = 
var _last= SUMX(FILTER(ALL('Activity details'),EOMONTH([Activity Submission Date and time],0)=EOMONTH(MAX([Activity Submission Date and time]),-12)),[Count])
return DIVIDE([Count]-_last,[Count])

The final output is shown below:

vyalanwumsft_0-1645173323912.png
Best Regards,
Community Support Team_ Yalan Wu
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

5 REPLIES 5
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could create a mesure to calculate count.

Count = 
IF (
    MONTH ( MAX ( [Activity Submission Date and time] ) ) = MONTH ( TODAY () ),
    CALCULATE (
        COUNT ( [Activity Id] ),
        FILTER (
            'Activity details',
            [Activity Submission Date and time]
                <= DATE ( YEAR ( [Activity Submission Date and time] ), MONTH ( TODAY () ), DAY ( TODAY () ) ))),
    COUNT ( [Activity Id] ))

and Percentage as follows:

Percentage = 
var _last= SUMX(FILTER(ALL('Activity details'),EOMONTH([Activity Submission Date and time],0)=EOMONTH(MAX([Activity Submission Date and time]),-12)),[Count])
return DIVIDE([Count]-_last,[Count])

The final output is shown below:

vyalanwumsft_0-1645173323912.png
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks @v-yalanwu-msft , It solved my issue. 🙂

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Can you post sample data as text and expected output?
Not enough information to go on;

 

Best Regards,
Community Support Team_ Yalan Wu

lbendlin
Super User
Super User

SAMEPERIODLASTYEAR() does not give you what you think it does. You need to add the YTD restriction yourself, otherwise it will return full periods.

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Please show the expected outcome.

 

Anonymous
Not applicable

Dear @v-yalanwu-msft  @lbendlin 

My Apology for replying so late as was travelling.

 

sameperiodlastyear is giving entire feb month counts but that should calculate till 18th Feb only (as of today's date) and due to this my % Increament calculation is getting wrong.

 

Desired Result is in green color below

bhuprakash_0-1645165178922.png

 

Attaching data with you. Please download from below link.

https://we.tl/t-jTkta5Kinb

 

Thanks a lot in advance. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.