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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Combine filters, Filter exception,

Hi all,

 

I want to show all tasks from a sellected month and the Delayed tasks from previous months.

Thanks!

 

MonthStatusTask
JanuaryDelayA
JanuaryOn trackB
JanuaryDoneC
MarchDelayD
MarchDoneE
MarchOn trackF
1 ACCEPTED SOLUTION

You should be able to do this:

 

Count Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      'Table',
      "__Selected",[Selected]
    )
RETURN
  COUNTROWS(FILTER(__Table,[__Selected] = 1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

8 REPLIES 8
Greg_Deckler
Super User
Super User

You will need a month number column and then you could do this:

 

Selected = 
  SWITCH(TRUE(),
    MAX('Table'[MonthNo]) = SELECTEDVALUE([MonthNo]),1,
    MAX('Table'[MonthNo]) < SELECTEDVALUE([MonthNo]) && [Status]="Delay",1,
    0
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler,

 

Thanks for the reply!

It's not working here, is this correct? 

&& [Status]="Delay"

 

Regards,

Lucas

Oh, if you are using this in a measure, you need to wrap that with an aggregation like && MAX([Status]="Delay"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler,

 

Thank you it worked, but now I have one problem. I need to count the number of tasks that are labeled as "1" and show it in a graph by Status, as it is not a collumn it's not working. Can you help with it? 

You should be able to do this:

 

Count Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      'Table',
      "__Selected",[Selected]
    )
RETURN
  COUNTROWS(FILTER(__Table,[__Selected] = 1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler ,

Thank you very much, It works!

 

But now I noticed one thing, I can't select more than one month, do you know how to solve this?

 

Is there a function to conver all values between MAX and MIN?

That's because you are using SELECTEDVALUE. You would have to use VALUES to get the values and then maybe use IN. Can you post expected output from the example data?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler ,

 

I want to select 1 or more months and have all tasks from them and the past "Delay" tasks.

For exemple, if selected March and April the output would be (K,A,D,E,F,G,H,I,J).

 

YearMonthNoMonthStatusTask
201912DecemberDelayK
201912DecemberOn trackL
201912DecemberDoneM
20201JanuaryDelayA
20201JanuaryOn trackB
20201JanuaryDoneC
20203MarchDelayD
20203MarchDoneE
20203MarchOn trackF
20204AprilDelayH
20204AprilDoneI
20204AprilOn trackJ

 

I realized that the year is not being considered, if I select january, december would not be shown. I could use 2001 (January 2020) and 1912 (December) but it would no be user friendly, is there a way to transforme numbers (MonthNo) in text just to show in the slicer?

 

Thank you!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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