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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
violet11_6
Regular Visitor

Dax Calculate formula cannot remove the impact of slicer

Hi.

 

I have a tab "PnL Summary" that contains a slicer [Year] that controls the actual financial summary of this tab as well as the detailed actual financial results in another tab "Details".  However, in the other tab "Details", I need to display an additional metric [Year-on-year 1H delta %] which pulls the difference between the first 6 months financial results of 2 years. As such, I need a new measure to return the 1H results of the previous year before I could work out the year-on-year difference. Note: slicer [Year] will control the actual financial results of both tabs but the financial results of 1H should always only pull the first 6 months results, regardless of the year selected under the slicer [Year]. 

 

For whatever reason, my Dax formula below does not seem to work (after narrowing down each filter under this formula):
PY_1H_Revenue = Calculate (sum(Fact_PnL[Value]), Fact_PL[Year] = "2022") {since my staff has set the year up as text instead of number}

 

I understand that the filter expressions in the CALCULATE formula should override the conditions selected under slicer. 

What else should I check for that I have not checked resulting in this error? Thanks. 

 

 

 

1 ACCEPTED SOLUTION
bcdobbs
Super User
Super User

I think the issue is that in your calculate you're using Fact_PL[Year].

Do you have the same Year filter in a date table or separate dimenesion? If you use that it should work.

 

The issue is that when you filter a fact table directly all the columns end up in the filter context and you're only overiding the year one.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

7 REPLIES 7
violet11_6
Regular Visitor

Hi,

 

No, the date table is not marked as a date table (I infer through the dropdown [mark as date table] as unselected).

 

Thanks.

Try marking it as a date table. Would hope that fixes.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
violet11_6
Regular Visitor

Hi,

 

There seem to be 3 other filters/slicers that are affecting my Dax formula. How can I find out the source of these slicers/filters?

 

Thanks. 

Try creating a new page with a simple visual for your measure to see if it works in isolation. 

If it works there then have a look at View >> Sync Slicers and see if anything is being synced from another page.

 

Failing that build the page back up one visual at a time (copy and paste) until it "breaks"



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
bcdobbs
Super User
Super User

I think the issue is that in your calculate you're using Fact_PL[Year].

Do you have the same Year filter in a date table or separate dimenesion? If you use that it should work.

 

The issue is that when you filter a fact table directly all the columns end up in the filter context and you're only overiding the year one.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Hi,

 

Thanks. You're correct. But now, I seem to face the same issue with the months, even though I tried filtering the month from a different dimension, just as I did with the year. 

Is month on a date table? Is the date table marked as a date table? (Right click on the table and it'll give you the option).

 

Failing that I'd need to see a bit more detail. Are you able to share a pbix file with some demo data?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.