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,
I wrote a measure like following:
When I put "Start Date" in the table, the result is correct. But for the bottom two tables, which I put "YearMonth" and "YearWeek" in the table, the result is not correct. Any solution to fix this?
Thanks a lot for your help!
Solved! Go to Solution.
Hi @YunJ ,
To my understanding, try to create your measure like so:
8 (2) =
CALCULATE (
SUM ( timetest[Sales] ),
FILTER (
ALLSELECTED ( timetest ),
timetest[Land Date] IN VALUES ( timetest[Start Date] )
&& timetest[Presale_or not] = "Y"
)
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @YunJ ,
To my understanding, try to create your measure like so:
8 (2) =
CALCULATE (
SUM ( timetest[Sales] ),
FILTER (
ALLSELECTED ( timetest ),
timetest[Land Date] IN VALUES ( timetest[Start Date] )
&& timetest[Presale_or not] = "Y"
)
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Icey
Thanks for your great solution.
May I ask why you use ALLSELECTED function? and why you use
timetest[Land Date] IN VALUES ( timetest[Start Date] )
rather than
timetest[Land Date] = SELECTEDVALUE( timetest[Start Date] )
Thanks for your time and patience!
Yun
Hi @YunJ ,
1. I use ALLSELECTED() to Remove context filters from columns and rows in the current query, while retaining all other context filters or explicit filters. For details, please refer to this blog: The definitive guide to ALLSELECTED.
2. If use SELECTEDVALUE(), the expression only works when one record "selected". But use VALUES(), it will return a list of records.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot @Icey ! I read the link and some source about ALLSELECTED. But I'm still wondering why we need to remove context filters from columns and rows?
For every row it has a unique value right? So it doesn't ignore the row filters right?
(Sorry I'm new to power bi, and sorry if I make my question silly... just still confused about ALL family DAX although learn for some time..)
Hi @YunJ ,
ALLSELECTED( timetest ) removes all filters of timetest table, except those included on this report page.
And the expression below is the reason why [Start Date] and [Year Week] keep working as filters. You can try to delete it and the result will be different.
timetest[Land Date] IN VALUES ( timetest[Start Date] )
This may be a little difficult to understand. It is suggested to refer to some documents and videos.
document:
Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT
video:
The Main Difference Between ALL And ALLSELECTED - Power BI & DAX
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@YunJ why you are using allexcept function? Can you define what you are trying to achieve?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k
I wrote allexcept(table[category]) to make my Category slicer can work. When I only used all(table), the Category slicer does not work.
Thanks
Yun
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |