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
jaryszek
Post Patron
Post Patron

DAX and visual to show only current year

Hi,

 

i am doing challenge from here:

https://curbal.com/25-days-of-dax-fridays-challenge#rules 
Report to download is here:
https://curbal.com/wp-content/uploads/2021/12/Northwind-challenge_exercise-file.zip

and want to write DAX to get visual only for 2022 and for products less than 20$. 

How to do this?

I tried with:

 

 

Product Less 20 $ = 
    CALCULATE(
        Products[Unit Price],
        KEEPFILTERS(
            'Calendar'[Year] = 2022
        ),
        FILTER(
            Products,
            Products[Unit Price] < 20
        )
    )

 

 

 

and result is for all years slicer:

jaryszek_0-1657200822719.png

what i want to get here is just all product names for 2022 ONLY and with prizes. So using only DAX (not filter on visual) - how to do this?
(it is strange that prize is the same for every year). 

 

So i do not want to get this visual filtered based on slicer. It should be always 2022 no matter filter which is on slicer:

jaryszek_0-1657201166471.png


Please help,
Jacek







 

 

1 ACCEPTED SOLUTION

Hi, @jaryszek 

If possible, try disabling the interaction between the ‘Year’ slicer and the table visual.

Best Regards,
Community Support Team _ Eason

View solution in original post

4 REPLIES 4
jaryszek
Post Patron
Post Patron

Thank you.

and how to remove filter concept from visual (straight table) to show always products for 2022 no matter what slicer has?:

 

jaryszek_0-1657264634310.png

So I should see in below visual 2022 always. I have to add Year as Measure = 2022? 
Or i can use some kind of filter modifiers like ALL?

Best,
Jacek

Hi, @jaryszek 

If possible, try disabling the interaction between the ‘Year’ slicer and the table visual.

Best Regards,
Community Support Team _ Eason

Thank you!

amitchandak
Super User
Super User

@jaryszek , Hope you are creating a measure not column ?

 

Product Less 20 $ =
CALCULATE(
Sum(Products[Unit Price]),
KEEPFILTERS(
'Calendar'[Year] = 2022
),
FILTER(
Products,
Products[Unit Price] < 20
)
)

 

or

 
Product Less 20 $ =
CALCULATE(
Sum(Products[Unit Price]),
FILTER('Calendar',
'Calendar'[Year] = 2022
),
FILTER(
Products,
Products[Unit Price] < 20
)
)

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.