Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I would like to write Dax to select all 3 highlighted rows. I wrote this and it does not grab all 3 row values.
var _Max_Date = DATE(2023,08,31)
VAR _ENR_DATE = EOMONTH(_Max_Date,-2)+1
Filter( table,([MIN_ENR] >= _ENR_DATE && [MAX_ENR] <= _Max_Date))
I want to also select Max_ENR if it is > _Max_Date
Solved! Go to Solution.
Hi @NilR ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a tables.
Table 2 =
var _Max_Date = DATE(2023,08,31)
VAR _ENR_DATE = EOMONTH(_Max_Date,-2)+1
return
Filter('Table', [max_enr]> _Max_Date)
Table 3 =
var _Max_Date = DATE(2023,9,1)
VAR _ENR_DATE = EOMONTH(_Max_Date,-3)+1
return
Filter('Table', [max_enr] >= _ENR_DATE && [max_enr] <=_Max_Date)
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NilR ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a tables.
Table 2 =
var _Max_Date = DATE(2023,08,31)
VAR _ENR_DATE = EOMONTH(_Max_Date,-2)+1
return
Filter('Table', [max_enr]> _Max_Date)
Table 3 =
var _Max_Date = DATE(2023,9,1)
VAR _ENR_DATE = EOMONTH(_Max_Date,-3)+1
return
Filter('Table', [max_enr] >= _ENR_DATE && [max_enr] <=_Max_Date)
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@NilR not the logic based on the DAX but what is your business logic? 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.
@NilR what is the logic?
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.
It seems like you want to select rows from a table where `MAX_ENR` is either between `_ENR_DATE` and `_Max_Date` or greater than `_Max_Date`. You can modify your DAX code to include this additional condition. Here's how you can do it:
```dax
VAR _Max_Date = DATE(2023,08,31)
VAR _ENR_DATE = EOMONTH(_Max_Date,-2)+1
EVALUATE
FILTER(
table,
([MAX_ENR] >= _ENR_DATE && [MAX_ENR] <= _Max_Date) || [MAX_ENR] > _Max_Date
)
```
In this code, the `FILTER` function is used to select rows from the `table` where `MAX_ENR` is either between `_ENR_DATE` and `_Max_Date` or greater than `_Max_Date`. The `||` operator represents logical OR in DAX¹. This should give you the desired output. Let me know if you need further assistance! 😊
your answer is correct and This is exactly what I need , but the result is not what I want.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
105 | |
99 | |
98 | |
38 | |
37 |
User | Count |
---|---|
152 | |
120 | |
73 | |
72 | |
63 |