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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
JacobMotu
Frequent Visitor

How to use two measures for filtering without breaking each other

My pbix file.

 

I have two measures created.

 

2DataPointsSoilBlock = COUNTROWS(
  FILTER(
    SUMMARIZE(
      tblSoilDetail,
      tblSoilDetail[Block],
      tblSamples[Year]
    ),
    [Block] <> BLANK() && [Year] <> BLANK()
  )
)

 

 

 

SampleCurrentYear = IF(YEAR('tblSamples'[Date]) = YEAR(TODAY()), "Yes", "No")

 


I need to "pre-filter" Block slicer. The first measure if set "greater than 1" hides Blocks with less than 2 data points (data for only 1 calendar year). The second measure if set "yes" hides Blocks that has no data for current year. All works fine when I use one of these measures at a time, but they break each other if used together.

Is there any way of merging them or walkaround?

1 ACCEPTED SOLUTION
JacobMotu
Frequent Visitor

I don't know how to make both measures work at the same time but I have found another solution.

As a replacement for the second measure (checking for this year) I a new query in Query Editor merging tables tblSoilDetail and tblSamples, and kept there only Block from the first and the Date from the latter. Erased all empty rows, duplicates, and filtered Date column to be this year.
After that I created a measure below and used it to pre-filter Block slicer by setting the ControlSoilBlock is not blank.

 

ControlSoilBlock = var _tab = SUMMARIZE(ALLSELECTED(FilterSoil), FilterSoil[Block])
return 
COUNTROWS(FILTER(tblSoilDetail, tblSoilDetail[Block] in _tab))

 

 

View solution in original post

1 REPLY 1
JacobMotu
Frequent Visitor

I don't know how to make both measures work at the same time but I have found another solution.

As a replacement for the second measure (checking for this year) I a new query in Query Editor merging tables tblSoilDetail and tblSamples, and kept there only Block from the first and the Date from the latter. Erased all empty rows, duplicates, and filtered Date column to be this year.
After that I created a measure below and used it to pre-filter Block slicer by setting the ControlSoilBlock is not blank.

 

ControlSoilBlock = var _tab = SUMMARIZE(ALLSELECTED(FilterSoil), FilterSoil[Block])
return 
COUNTROWS(FILTER(tblSoilDetail, tblSoilDetail[Block] in _tab))

 

 

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.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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