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
MrMichael
Frequent Visitor

Filter expression vs Boolean filters in calculatetable yields different results

The purpose of this question is to understand the filter context of calculatetable. 

Problem statement:
I have a table (MyTable) of descriptions and a month for the given description. 
And would like to return how many times a given description repeats within a month

Solutions:
 * Solution that works:
var MonthDescriptionTable  = CALCULATETABLE(MyTable,
       FILTER(MyTable,
MyTable[DESCRIPTION]=EARLIER(MyTable[DESCRIPTION]) && MyTable[MONTH] = EARLIER(MyTable[MONTH])
        )
)

return COUNTROWS(MonthDescriptionTable)

* Solution that does not work:
var MonthDescriptionTable = CALCULATETABLE(MyTable,MyTable[DESCRIPTION]=EARLIER(MyTable[DESCRIPTION]) &&MyTable[MONTH] = EARLIER(MyTable[MONTH]))

return COUNTROWS(MonthDescriptionTable)

To sum up; how come the boolean filter does not work compared to the filter expression? 

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @MrMichael ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1679623600623.png

It seems that the results are the same:

vjianbolimsft_1-1679623640737.png

vjianbolimsft_2-1679623650702.png

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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