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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
jwin2424
Resolver I
Resolver I

Formula stops working when year filter is added

I am perplexed as to why this is happening. When I use the formula without adding a year filter, it works perfectly. When I filter to a year or specific years, it breaks. I don't understand what I am doing wrong 😞

jwin2424_0-1731090379516.png
What am I doing wrong?

The filter for the year is on the visual itself (Visual Level Filter).


***EDIT***

I have narrowed down the problem to one specific filter. For some reason, when this filter is applied, the numbers go haywire.

jwin2424_1-1731097841984.png

 


I have it exclude the blank values at the page-level filter. When excluding the blanks for the current year count, it is correct. But when I exclude the blanks using the PY measure, the number shrinks quite a bit. It does not do this when I apply any other filters. 

Here is the filter applied

Assigned to Partner =
LOOKUPVALUE(Accounts[name], Accounts[accountid], Leads[assigntopartnercompanyid])





Thanks

 



1 ACCEPTED SOLUTION

Unfortunately, that doesn't work for me. It removes all filters and then won't apply page-level filters. This is the result

jwin2424_0-1731362805570.png


I did try a different varation of the formula. I used LOOKUPVALUE to retrieve the "created on" year. Since our fiscal calendar starts on Jan 1st and ends of Dec 31st, using the year can work by just using the actual calendar year and not the LOOKUPVALUE. For some reason, this formula worked. 

Leads (PY) =
VAR _PY =
MAX(Leads[Created On].[Year])-1

RETURN
CALCULATE(
    [Lead Count],
    Leads[Created On].[Year] = _PY
)



I am not sure why my lookupvalue year doesn't work. 

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@jwin2424 can you share your data model to understand it further.



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.

The data model is a direct link to my company CRM, so I can't share the file. Here is my scheme (columns hidden)

jwin2424_0-1731105782636.png


Currently, the formula only references the table. The filters reference these tables:
Territory
Campaign
Leads

Where I am looking up the partner name is from the Accounts table. I already have a connection to the Accounts table through different primary key. I need it to remain that way. For that reason, I just did a lookup for the partner account. However, I have this issue not just on the partner filter, i can add a product filter and the issue is the same. 

jwin2424_1-1731106021275.png


So it seems to work with some filters, but not with all filters. If I just do current year, all the filters work. The second I ask it to give me the count from year - 1 it just breaks. I dont get it !

Hi @jwin2424 

modify your calculate statement as below and check.
calculate(count(leads,[LEA ID]), all(leads), created on year = __currentYR-1)

What I feel, you cannot refer to the previous year section in a matrix using measure, until and unless you open the table filter.

if this doesn't works, share a sample table with dummy data representing your "Leads" Table
 



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Unfortunately, that doesn't work for me. It removes all filters and then won't apply page-level filters. This is the result

jwin2424_0-1731362805570.png


I did try a different varation of the formula. I used LOOKUPVALUE to retrieve the "created on" year. Since our fiscal calendar starts on Jan 1st and ends of Dec 31st, using the year can work by just using the actual calendar year and not the LOOKUPVALUE. For some reason, this formula worked. 

Leads (PY) =
VAR _PY =
MAX(Leads[Created On].[Year])-1

RETURN
CALCULATE(
    [Lead Count],
    Leads[Created On].[Year] = _PY
)



I am not sure why my lookupvalue year doesn't work. 

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.