Forum Discussion
SUMX with filter using SELECTEDVALUE
Hey
Im fairly new to Power BI and im trying to solve SUMX to a non-related table.
The table im trying to get correct number from has info like this:
Elements Table:
| Projectnumber | Code2 | Start Date | End Date | Demand |
| 12345678 | 10.10.10 | 01.01.2019 | 31.12.2019 | 6 |
| 12345679 | 10.10.11 | 15.07.2019 | 31.12.2019 | 6 |
| 98765432 | 10.10.10 | 01.01.2019 | 15.07.2020 | 12 |
In my visuals this table works great, since it filters on Project number. And i dont get issues at all. But i cant pull the data based on project number into power bi, I have to get this list with everything in it.
I have made a calendar that uses First date from Start Date and last date from End date. Then made new colums adding:
Year = year('Calendar'[Date])
I have tried this so far for a new column:
IF('Calendar'[Year-Week]=BLANK();BLANK();
sumx(filter('Elements';Elements[Projectnumber]="12345678");Elements[Demand]);
IF('Calendar'[Year-Week]=BLANK();BLANK();
Hi ebbrey ,
To have the measure based on the currently selected project, you'd need to use a calculated measure instead of a calculated column.
Does this help you?
If it doesn't, can you share a sample Power BI file?
You can share it via One Drive, Google Drive or a similar tool.
Regards,
LC
Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com
3 Replies
- lc_financeSolution Sage
Hi ebbrey ,
To have the measure based on the currently selected project, you'd need to use a calculated measure instead of a calculated column.
Does this help you?
If it doesn't, can you share a sample Power BI file?
You can share it via One Drive, Google Drive or a similar tool.
Regards,
LC
Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com
- ebbreyFrequent Visitor
Thanks for your reply to my question and pointing me away from trying to use selectedvalue in a column.
I ended up getting it to work by using a referance table wich i could relate to the project table and get the filter i needed.
- lc_financeSolution Sage
I'm glad you found a solution for it!
Do not hesitate if you have more questions.
LC
Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com