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.
Hi All
I need to expression to filter those customer purchase only in 2020 and not 2019 , as indicated in below image , those i highlight in red box :-
My PBI file :-
Paul
Solved! Go to Solution.
Hi @Paulyeo11
See it all at work in the attached file. Create this measure and place it in the visual:
SALES_ V2 =
VAR sales2019_ = CALCULATE(SUM(SALES[sales]), 'Date'[Year] = 2019)
VAR sales2020_ = CALCULATE(SUM(SALES[sales]), 'Date'[Year] = 2020)
RETURN
IF (
NOT ISBLANK ( sales2019_ ) && ISBLANK ( sales2020_ )
&& ( SELECTEDVALUE ( 'Date'[Year] ) = 2019 || NOT ISFILTERED ( 'Date'[Year] )),
sales2019_
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Sure. Minor modification to your code:
2020_only V2 =
VAR sales2018_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2018 )
VAR sales2019_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2019 )
VAR sales2020_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2020 )
RETURN
IF (
NOT ISBLANK ( sales2020_ ) && ISBLANK ( sales2019_ )
&& ISBLANK ( sales2018_ )
&& (
SELECTEDVALUE ( 'Date'[Year] ) = 2020
|| NOT ISFILTERED ( 'Date'[Year] )
),
sales2020_
)
See it all at work in the attached file.
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Sure. Minor modification to your code:
2020_only V2 =
VAR sales2018_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2018 )
VAR sales2019_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2019 )
VAR sales2020_ =
CALCULATE ( SUM ( SALES[sales] ), 'Date'[Year] = 2020 )
RETURN
IF (
NOT ISBLANK ( sales2020_ ) && ISBLANK ( sales2019_ )
&& ISBLANK ( sales2018_ )
&& (
SELECTEDVALUE ( 'Date'[Year] ) = 2020
|| NOT ISFILTERED ( 'Date'[Year] )
),
sales2020_
)
See it all at work in the attached file.
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi AIB
Appreciated very much , you code working fine. Thank you very much.
Paul
Hi @Paulyeo11
See it all at work in the attached file. Create this measure and place it in the visual:
SALES_ V2 =
VAR sales2019_ = CALCULATE(SUM(SALES[sales]), 'Date'[Year] = 2019)
VAR sales2020_ = CALCULATE(SUM(SALES[sales]), 'Date'[Year] = 2020)
RETURN
IF (
NOT ISBLANK ( sales2019_ ) && ISBLANK ( sales2020_ )
&& ( SELECTEDVALUE ( 'Date'[Year] ) = 2019 || NOT ISFILTERED ( 'Date'[Year] )),
sales2019_
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi AIB
Below expression is filter those new customer buy in 2020. Meaning those who buy in 2020 and not buy in 2019.
May i know how to add one more condition to above expression :-
Include those customer Buy in 2020 and also not buy in 2018. And consider as 2020 new customer. ( Because i have 3 year data )
Remark :-
Pls note that above sample data only have 2 year data , my actual data have 3 year data .
Paul Yeo
@Paulyeo11 , I think Nutek PTE LTD will also not come. Please find the attached file after signature
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |