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.
Hello,
I would like to get the categoryid of the next value based on the "End"date and "start"date.
See below the result category is the output that i need:
id | groupid | categoryid | Product | start | end | qty | Result categoryid |
12 | A | 1 | test | 1-1-2019 | 1-2-2019 | 1 | 2 |
13 | A | 2 | test2 | 1-2-2019 | 2-5-2019 | 1 | 4 |
14 | A | 2 | test2 | 1-3-2019 | 2-5-2019 | 1 | 4 |
4 | B | 1 | test18 | 1-5-2019 | 1 | ||
5 | C | 4 | test3 | 2-5-2019 | 2 |
i have used the following measure:
I have found a way, but it only works on a small dataset. When i try it on a large dataset i get a memory error.
Does somebody have a idea how i can decrease the load so i wouldnt get a memory error?
result_categoryid = VAR v_end = SELECTEDVALUE(Table[end]) VAR v_group = SELECTEDVALUE(Table[groupid]) VAR v_nextstart = CALCULATE(MINX(Table,Table[start]),ALLSELECTED(Table),DATESBETWEEN(Table[start],v_end,EDATE(v_end,1)),Table[groupid]=v_group) VAR v_id = CALCULATE(MINX(Table,Table[id]),ALLSESLECTED(Table),Table[start]=v_nextstart,Table[groupid]=v_group) VAR v_category = CALCULATE(SELECTEDVALUE(Table[categoryid]),ALLSELECTED(Table),Table[id]=v_id) RETURN IF(SELECTEDVALUE(Table[end])=BLANK(),BLANK(),IF(SELECTEDVALUE(Table[id])=v_id,BLANK(),v_category))
Kind regards
Hi,
Have you tried using Lookupvalue. Basically you will need to Create a new column with the below DAX
LOOKUPVALUE(Table[Category_ID],Table[End_Date],Table[Start_Date])
Hi,
I dont want to use a calculated column, i would like to use it in a measure.
And the lookupvalue also isnt working, this because the startdate of the next value could be later/higher then the rows enddate.
Kind regards,
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 |
---|---|
41 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
36 | |
33 | |
18 | |
18 |