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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jwillis07
Helper I
Helper I

How to include a secondary filter within this measure?

Hi all, hoping you can help me with something...

 

Say I have Table1, with the below columns:

  • id
  • date
  • type

 

I've written this measure, and by written, I mean copied off the internet somewhere and can't remember where:

 

cumulative = 
CALCULATE(
	COUNTA(Table1[id]),
	FILTER(
		ALLSELECTED(Table1[date]),
		ISONORAFTER(Table1[date], MAX(Table1[date]), DESC)
	)
)

 

 

Which then produces this visual by adding the date column to the x-axis, and the measure as a line value:

snip_visual.JPG

 

So my question is: How can I incorporate a second filter where the column "type" is "A"?

 

The aim is to replace this singular line with 4, one for each type, "A", "B", "C" & "D"

 

Thank you in advance!

1 ACCEPTED SOLUTION

cumulative =
CALCULATE(
    COUNTA(Table1[id]),
    FILTER(
        ALLSELECTED(Table1[date]),
        ISONORAFTER(Table1[date], MAX(Table1[date]), DESC)
    ),Table[Type] == "A"
)
Just Change A for the other three measure then put all the measures

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



View solution in original post

6 REPLIES 6
Samarth_18
Community Champion
Community Champion

Hi @jwillis07 ,

 

Please try this:-

cumulative = 
CALCULATE(
	COUNTA(Table1[id]),
	FILTER(
		ALLSELECTED(Table1[date]),
		ISONORAFTER(Table1[date], MAX(Table1[date]), DESC) && 
                Table1[type] in {"A","B","C","D"}
	)
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi, thanks for the response. Tried this but it doesn't seem to work unfortunately as it won't allow me to add Table1[type] - the type part is greyed out.

 

I think maybe it's something to do with the ALLSELECTED part.

 

Whenever I type... Table1[ ... The autofill options only show me the table, the date column and a different measure in this table - won't allow me to enter any other column names.

mh2587
Super User
Super User

You can simply use page filter by selecting type A,B, or C 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Hi, thanks for the response. Yeah you're right in that I could just apply add 'type' to the page filter but that wouldn't allow for me to have 4 lines in one visual, one for each type.

cumulative =
CALCULATE(
    COUNTA(Table1[id]),
    FILTER(
        ALLSELECTED(Table1[date]),
        ISONORAFTER(Table1[date], MAX(Table1[date]), DESC)
    ),Table[Type] == "A"
)
Just Change A for the other three measure then put all the measures

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Yep, this is it. Thank you very much, really appreciate it.

 

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.