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.
I have a table like the following:
Week Key | Week Label | Year |
2019.1 | a | 2019 |
2020.2 | b | 2020 |
2021.1 | a | 2021 |
I have a line chart with [Week Label] (**not [Week Key]**) on the x-axis. I want to return the cumulative sum of some numerical column in my fact table for [Year] = 2020. How can I do so? I have tried the following, but DAX is saying that, for the LOOKUPVALUE portion of the code, "a table of multiple values was supplied where a single value was expected." So, I must not be filtering 'Dimension Week' correctly in the LOOKUPVALUE portion of the code.
Cumulative Sum of Sales - 2020 =
VAR __given_week =
MAX('Dimension Week'[Week])
VAR __corresponding_week_key =
CALCULATE(
LOOKUPVALUE(
'Dimension Week'[Week Key]
,'Dimension Week'[Week]
,__given_week
)
,'Dimension Week'[Year] = "2020"
)
RETURN
CALCULATE(
[Sum of Sales - Year 2020]
,ALLEXCEPT(
'Dimension Week'
,Dimension Week'[Year]
)
,'Dimension Week'[Week Key] <= __corresponding_week_key
)
I think I solved my problem. I was misunderstanding the syntax for LOOKUPVALUE.
Thanks for your update. As the issue is resolved. I will close this thread.
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 |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |