March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi Team,
I am facing problem to write below sql subqueries in DAX
select count( a.member_key) from (
select a.member_key as member_key from Fact_Member_Analysis a
join Dim_Store c on a.Store_Key = c.Store_Key
join Dim_Member b on a.Member_Key = b.Member_Key
where Sales_Date_Key like '202007%' and b.Member_Key not in (-1)
and SALES_TRANSACTION_PLATFORM not like 'xyz' and b.Member_Group_Key in (9, 10, -1) and c.Store_State_Key = 5
group by a.Member_Key
having count( a.Store_Key)>=2) a
I have tried to write DAX but getting wrong answer.
Solved! Go to Solution.
@romakhatua , Can you share sample data and sample output in table format?
@Anonymous , Try like
SUMX(filter(SUMMARIZE(
Fact_Member_Analysis,Fact_Member_Analysis[Member_Key],
"Count_Store",
calculate(COUNT(Fact_Member_Analysis[Store_Key]),FILTER(Dim_Member,Dim_Member[Member_Group_Key] in {9, 10, -1}
&& Dim_Member[Member_Key] <> -1),
FILTER(Fact_Member_Analysis,Fact_Member_Analysis[SALES_TRANSACTION_PLATFORM]<> "xyz")
,FILTER(Template,Template[Month_Key]=[this_month]))),[Count_Store] >2),[Count_Store]
)
Thanks @amitchandak ,
Its giving the same result. Not the correct answer which I am getting from sql.
@romakhatua , Can you share sample data and sample output in table format?
@amitchandak ,Actually there was an issue with the filter while pulling from data source.
Your solution works for me. Thanks
@Anonymous can you share sample data ? If not, we are guessing. Please share sample data and the expected result.
How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting@Anonymous this is weird that you are looking for help from the community but not ready to share sample data. How do you expect help if you can't help us? Why not you slap some sample dummy data and share it? You need to help us to get help otherwise nobody has time to do the guesswork and solve your issue.
Good luck!
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |