Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowGet certified as a Fabric Data Engineer: Check your eligibility for a 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700. Get started
Hello,
I'm very new to PowerBI Desktop. How do I select 150 records with two conditions? If it's in SQL, it would be like this below:
SELECT TOP(150)*
FROM dbo.CUSTOMER
WHERE BATCHREF = "DRM" AND SAMPLE = "No"
I play around with TOPN but I don't know how to add conditions. Please help.
Thank you
Solved! Go to Solution.
Hi @siumui ,
You can create a calculated table like this:
Table =
TOPN (
5,
FILTER (
ALL ( CUSTOMER ),
'CUSTOMER'[BARCHREF] = "DRM"
&& 'CUSTOMER'[SAMPLE] = "No"
),
'CUSTOMER'[ID], ASC
)
Attached a sample file in the below, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @siumui ,
You can create a calculated table like this:
Table =
TOPN (
5,
FILTER (
ALL ( CUSTOMER ),
'CUSTOMER'[BARCHREF] = "DRM"
&& 'CUSTOMER'[SAMPLE] = "No"
),
'CUSTOMER'[ID], ASC
)
Attached a sample file in the below, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-yingjl
I tried the codes. It works awesome!!! Thank you for all your help!! 🙏
@siumui ,first create a measure
measure=calculate(countrows(filter(CUSTOMER,CUSTOMER[BATCHREF] = "DRM" && CUSTOMER[SAMPLE] = "No")))
then try TOPN
Top 10 Rank = CALCULATE([measure],TOPN(10,all(CUSTOMER[CUSTOMER Id]),[measure],DESC),VALUES(CUSTOMER[CUSTOMER Id]))
Hi @amitchandak
I follow your instructions and create a measure in report Modeling by choose "New measure". Then I go to the Data, click on Table Tools and select "New table" then I entered the code you have written for TOPN in the formula bar. It gives me the error "The expresion specified in the query is not valid table expression." It doesn't tell me where/what. Please help.
Thank you.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
146 | |
72 | |
63 | |
52 | |
51 |
User | Count |
---|---|
208 | |
91 | |
62 | |
59 | |
56 |