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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

How not to impact a filter in a measure

Hi, i'd like a filter not impact in a measure, when selecting this. Actually, when i activate the filter, bar of Quantità No Prom disappear but i want that these stay there.

Without filter:

userpien_0-1724923458829.png

 

Selecting filter:

userpien_1-1724923493006.png

 

userpien_2-1724923508745.png

 


if it helps, here is the measure for Quantità No Prom

Quantità No Prom=

VAR _1 =IF([Quantità No Prom]>0, [Quantità No Prom]/[Giorni No Prom])
VAR _2 = CALCULATE(COUNTX(VALUES(ANCLI[PuntID]),_1),FILTER(VALUES(ANCLI[PuntID]),[Quant]<>BLANK()))
VAR _3 = DIVIDE(_1,_2)
RETURN
IF([Solo Quant],_3 ,BLANK())


i hope you can help me,
thank you

1 ACCEPTED SOLUTION

I have tested such scenario with a dummy data. It is perfectly working.

This is my only data set. I have tried to find out average where that average should not affected by date filter.

Here is the dataset:

shafiz_p_0-1724945346848.png

 

See my measure and and slicer:

shafiz_p_1-1724945391104.png

See test is not affected when I select other data:

shafiz_p_2-1724945453075.png

I would suggest you to independently check measure , is the responding with the slicer selection or not.

View solution in original post

9 REPLIES 9
shafiz_p
Resident Rockstar
Resident Rockstar

Hi @Anonymous  You can use ALL() function to remove filter from specific table or column. If you don't want your calendar table interact with the measure then use ALL('Calendar').

Hope this helps!!
If this solved your problem, please accept it as a solution!!

Best Regards,
Shahariar Hafiz

Anonymous
Not applicable

Hi, thanks, but where i have to put ALL() in my DAX formula?

Inside calculate function. 

Try this:
CALCULATE(COUNTX(VALUES(ANCLI[PuntID]),_1),FILTER(VALUES(ANCLI[PuntID]),[Quant]<>BLANK()), all(Calendar))

Anonymous
Not applicable

it doesn't work. How can i edit this?

You have used IF condition, where you would not be able to use ALL() filter funtion. Try this for var _3 :

VAR _3 =
CALCULATE(
    DIVIDE(
        IF([Quantità No Prom]>0, [Quantità No Prom]/[Giorni No Prom]),
        CALCULATE(
            COUNTX(VALUES(ANCLI[PuntID]), IF([Quantità No Prom]>0, [Quantità No Prom]/[Giorni No Prom])),
            FILTER(VALUES(ANCLI[PuntID]),[Quant]<>BLANK())
        )
    ),
    ALL(Calendar)
)
Anonymous
Not applicable

i tried but doesn't work

Since I don't know about your data, your motivation, it is hard to tell specific solution. Replace your measure with the below code (Try this, If not I am sorry):

 

Quantità No Prom=
CALCULATE(
    IF(
    [Solo Quant],
    DIVIDE(
        IF([Quantità No Prom]>0, [Quantità No Prom]/[Giorni No Prom]),
        CALCULATE(
            COUNTX(VALUES(ANCLI[PuntID]), IF([Quantità No Prom]>0, [Quantità No Prom]/[Giorni No Prom])),
            FILTER(VALUES(ANCLI[PuntID]),[Quant]<>BLANK())
        )
    ),
   BLANK()
 ),
 ALL(Calendar)
)

 

Replace calendar with your table. This measure will check if true, the evalute divide else blank and remove all filters from calendar table.

Hope this solve your problem.

Anonymous
Not applicable

i tried again, but it didn't work. 

I have tested such scenario with a dummy data. It is perfectly working.

This is my only data set. I have tried to find out average where that average should not affected by date filter.

Here is the dataset:

shafiz_p_0-1724945346848.png

 

See my measure and and slicer:

shafiz_p_1-1724945391104.png

See test is not affected when I select other data:

shafiz_p_2-1724945453075.png

I would suggest you to independently check measure , is the responding with the slicer selection or not.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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