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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
alexumagba
Frequent Visitor

Slicing table output

I current have this table that I am working with.

alexumagba_1-1669733543804.png

 

 

 I want to write a DAX function to display the table below where the following rules is applied

1. Show name of account opened in the 2020 to 2022 and where subscription year is 2022

2. Don't show name of account that subscription year is not 2022

3. Show name of account open in 2022 and subscription year is blank.

4. Don't show account open before 2022 and subscription year is blank

 

alexumagba_0-1669733494128.png

 

2 ACCEPTED SOLUTIONS
v-yangliu-msft
Community Support
Community Support

Hi  @alexumagba ,

 

 

Here are the steps you can follow:

1. Create measure.

Flag =
SWITCH(
    TRUE(),
YEAR(MAX('Table'[Year opened])) >=2022&&MAX('Table'[subscription year])=BLANK(),1,
YEAR(MAX('Table'[Year opened])) >=2020&&
YEAR(MAX('Table'[Year opened]))<=2022 &&
YEAR(MAX('Table'[subscription year]))=2022,1,
YEAR(MAX('Table'[subscription year]))=2022,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1669795005419.png

3. Result:

vyangliumsft_1-1669795005423.png

 

Best Regards,

Liu Yang

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

View solution in original post

Thanks. This works perfectly well

View solution in original post

6 REPLIES 6
v-yangliu-msft
Community Support
Community Support

Hi  @alexumagba ,

 

 

Here are the steps you can follow:

1. Create measure.

Flag =
SWITCH(
    TRUE(),
YEAR(MAX('Table'[Year opened])) >=2022&&MAX('Table'[subscription year])=BLANK(),1,
YEAR(MAX('Table'[Year opened])) >=2020&&
YEAR(MAX('Table'[Year opened]))<=2022 &&
YEAR(MAX('Table'[subscription year]))=2022,1,
YEAR(MAX('Table'[subscription year]))=2022,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1669795005419.png

3. Result:

vyangliumsft_1-1669795005423.png

 

Best Regards,

Liu Yang

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

Thanks. This works perfectly well

Anonymous
Not applicable

I would try Summarize and Filter for the conditions you have listed

djurecicK2
Super User
Super User

@alexumagba Ok. Seems like you could do this in Power Query Editor.

djurecicK2
Super User
Super User

Hi @alexumagba ,

 Is there a reason why you want to do this in DAX instead of using filters on the table?

Please disregard the filter. This is suppose to be a daily automated task. I want to avoid using the filter everyday

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors