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 Friends,
Could someone help me with my scenerio please? i need to find the product which shows in the year 2022 & 2023. Third coulmn is the result i am expecting using dax.
Produst | Year | Sold both year |
A | 2022 | X |
B | 2023 | X |
C | 2023 | |
D | 2023 | |
A | 2023 | X |
B | 2023 | X |
thanks in advance for your help!!
Solved! Go to Solution.
and if you write like this, it solves your problem
and if you write like this, it solves your problem
again, you didn't demonstrate that in your dataset
am I missing something? It shows both years in the picture??
sorry @OliverO i am not able to pull all the scenerio. i come to know only after applying the code and reviewing the result.
try with the below data set. the product C is in 2 rows but the year in 2023 for both, so we no need to mark "X" here
Produst | Year | Date | Sold both year |
A | 2022 | 03/17/2022 | X |
A | 2022 | 03/16/2022 | X |
B | 2023 | 03/17/2023 | X |
C | 2023 | 03/16/2023 | |
C | 2023 | 03/17/2023 | |
D | 2022 | 03/16/2022 | |
A | 2023 | 03/17/2023 | X |
B | 2022 | 03/16/2022 | X |
Thank you @Ahmedx
this code is working partially and the Product check is not working as expected. for example, the product should be in both 2023 and 2022 to mark "X".
thanks for your support.
you should always put down a representative data set so people don't waste time solving the wrong problem
sorry about that @OliverO
Hope the below data helps.
Produst | Year | Date | Sold both year |
A | 2022 | 03/17/2022 | X |
A | 2022 | 03/16/2022 | X |
B | 2023 | 03/17/2023 | X |
C | 2023 | 03/17/2023 | |
D | 2022 | 03/16/2022 | |
A | 2023 | 03/17/2023 | X |
B | 2022 | 03/16/2022 | X |
Try this
Thank you @OliverO ,
with the give code we are not checking the year anywhere. this will work when i have only 1 row for 2022 or 2023.. but i have a scenerio where i can have the same product multiple times in the same year with different date. so checking year is mandate for me
Sold both year = IF([Produst] in {"A","B"}&&[Year] in {2022,2023},"X")
@Ahmedx thanks for the quick response..
can i refer a coulmn instead of {"A","B"}, because the product list is not restricted with A or B.
Thanks again
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 |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
138 | |
107 | |
104 | |
82 | |
63 |