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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jostnachs
Helper IV
Helper IV

YTD Slicer

Hi All, I have a requirement where i have to have YTD slicer. i.e. if i select June 2025, the table should populate values from Jan-25 till June-25 , if I select feb-24, the table should populate values from Jan-24 till feb-24. 

After researching, i ama able to acheive this by creating a duplicte dte table and having a passive relationship and using measure. But i have an issue when  I try to use it with other fields in a table. the table just breaks. the moment i add premium and commission in the table

jostnachs_0-1750800126775.png

jostnachs_1-1750800146085.png

VAR SelectedDate = MAX('Month Accounting'[MonthEndDate])  
VAR SelectedYear = YEAR(SelectedDate)  
VAR SelectedMonth = MONTH(SelectedDate)
VAR FirstDateOfYear = DATE(SelectedYear, 1, 1)  
VAR Result =
    CALCULATE(
        [Current Company Revenue],  
        REMOVEFILTERS('Month Accounting'),  
        'Month Accounting'[MonthEndDate] >= FirstDateOfYear,  
        'Month Accounting'[MonthEndDate] <= SelectedDate,  
        USERELATIONSHIP('Date'[MonthEndDate], 'Month Accounting'[MonthEndDate])  
    )

RETURN Result
jostnachs_2-1750800258838.png

 

 

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

I have solved a similar problem in the attached file.

Hope this helps.

Ashish_Mathur_0-1750809253002.png

 


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

Thank you for sharing this...

I tried this too changing my relationship from Month accounting to the fact table. but the behaviour is same the table breaks saying query exceeding resources the moment i use the measure in the table along with other.

Commission_UpToSelectedDate1 =
VAR SelectedDate = MAX('Month Accounting'[MonthEndDate])  
VAR SelectedYear = YEAR(SelectedDate)  
VAR SelectedMonth = MONTH(SelectedDate)
VAR FirstDateOfYear = DATE(SelectedYear, 1, 1)  
VAR Result =
    CALCULATE(
        [Current Company Revenue],  
        REMOVEFILTERS('Month Accounting'),  
        'Month Accounting'[MonthEndDate] >= FirstDateOfYear,  
        'Month Accounting'[MonthEndDate] <= SelectedDate,  
        USERELATIONSHIP('Date'[MonthEndDate], _Production[D_AccountingMonth])  
    )

RETURN Result

Hi @jostnachs ,

Thank you for the update. 

The issue occurs when a visual has attempted to query too much data for the server to complete the result with the available resources.

As suggested in the error, you may need to try filtering the visual to reduce the amount of data in the result currently. there is limit. Apply data-point limits and strategies by visual type 

 

And you can follow the tips to optimize your report:

1.Do not expose in a view a column that is not necessary in the Power BI data model.

2.Optimize the DAX calculation used in this visual to use less memory and return faster or change what the visual displays.

3.Remove unnecessary precision or split granularity values to reduce cardinality(Significantly reduce highly unique datetime values by splitting the date and time into separate columns. )

Reference: Chris Webb's BI Blog: The “Visual Has Exceeded The Available Resources” Error In Power BI

If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

Thanks,
Chaithra E.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.