Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I have a table visual and would like to display if the item that exists in the latest year (latest year in the data selected) by a measure.
Below is the sample data and expected output:
Unit table: | ||
Item | Year | unit |
Fruit | 2022 | 100 |
Fruit | 2021 | 200 |
Fruit | 2020 | 500 |
Veggies | 2021 | 100 |
Veggies | 2020 | 40 |
Meat | 2022 | 150 |
Meat | 2021 | 250 |
Expected output: Here "Item exist in the latest selected year" is the output measure that will say whether the Item exists in the latest year (here 2022 is the latest or maximum year). If the item exists in the latest year then it should return "Yes" else if the item is not there in the latest year then it should be "No".
Item | Year | unit | Item exist in the latest selected year |
Fruit | 2022 | 100 | Yes |
Fruit | 2021 | 200 | Yes |
Fruit | 2020 | 500 | Yes |
Veggies | 2021 | 100 | No |
Veggies | 2020 | 40 | No |
Meat | 2022 | 150 | Yes |
Meat | 2021 | 250 | Yes |
Please can you let me know how to achieve this result.
Thanks,
AnthonyJoseph
Hello!
Try something like:
Exist in latest year =
var latest = CALCULATE(MAX('Table'[Year]), ALLSELECTED('Table'))
var itemsInLatestYear = SELECTCOLUMNS(FILTER(ALL('Table'), 'Table'[Year] = latest), "Items", 'Table'[Item])
return IF(SELECTEDVALUE('Table'[Item]) in itemsInLatestYear, "Yes", "No")
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
18 | |
15 | |
12 | |
11 | |
8 |
User | Count |
---|---|
24 | |
18 | |
12 | |
11 | |
10 |