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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.