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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
adoster
Resolver I
Resolver I

Create a Measure which ignores specific Filter not working: Using ALL()

Hello,

I am trying to calculate the count of Days a User worked at least 1 hour while ignoring a specific page filter.

Each Day should only be counted once. Other Filters should still work.

 

Here is my Measure:

 

WorkedDays =

CALCULATE(

    COUNTROWS(

        SUMMARIZE(

            FILTER(TABLEA, TABLEA[WorkedHours] > 0),

            TableA[Date]

        )

    ),

    ALL(TABLEA[TESTFILTER]),   // Remove filter effect of TESTFILTER

    ALLSELECTED(TABLEA),

    FILTER(TABLEA, TABLEA[WorkedHours] > 0)

)

 

When I set a TESTFILTER to Green it drops my total for Worked Days but should not.

I need this value to be static so that I can find the average Widgets Produced for all days worked.

 

Here is a sample table and expected results:

UserDateWidgets MadeHours WorkedTestFilter
10018/1/202311Green
10018/1/202311Red
10028/1/202311Green
10028/2/202311Green

 

Results with no Filter
UserTotal Days WorkedTotal Widgets
100122
100222

 

Desired Results (Page Filter on TestFilter = Green)
UserDays WorkedTotal WidgetsAVG Widgets August
1001210.5
1002221

Currently w/ the page filter set I get 1 Day worked for 1001

 

Thank you for any assistance!

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@adoster try these measures:

 

Days Worked = CALCULATE ( COUNTROWS ( 'Table' ), REMOVEFILTERS ( 'Table'[TestFilter] ) )

Total Widgets = SUM ( 'Table'[Widgets Made] )

Avg Widgets = DIVIDE ( [Total Widgets], [Days Worked] )


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.

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@adoster beautiful, good to hear. Cheers!



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.

parry2k
Super User
Super User

@adoster try these measures:

 

Days Worked = CALCULATE ( COUNTROWS ( 'Table' ), REMOVEFILTERS ( 'Table'[TestFilter] ) )

Total Widgets = SUM ( 'Table'[Widgets Made] )

Avg Widgets = DIVIDE ( [Total Widgets], [Days Worked] )


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.

I added DistinctCount but your code basically worked. Thank you!
 
WorkedDays =
CALCULATE(
    DISTINCTCOUNT('Table'[Final Date]),
    REMOVEFILTERS('Table'[TestFilter])
)
parry2k
Super User
Super User

@adoster it will easier if you can share sample pbix using one drive/google drive and the expected output. Without knowing your data model and required output, it is very hard to decode the DAX expression.



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.

Hello,

I edited the original post and included sample data.

This is a slimmed down version of my original data which I am unable to post.

Thanks!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.