Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Vitor_sp_bo
Helper I
Helper I

count with parameter

Spoiler

good afternoon guys!

I have a promotion sheet, with a start and end date, and I made a count, but I need to put some parameters in this count, I need that if a product has more than one promotion in the same month and with the same end date (Example 10/23 and 10/23) I just count it as 1,

Any questions please, just ask

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Vitor_sp_bo ,

Do you mean using the parameters in Power bi desktop to count, I have an example here

I created some data:

vyangliumsft_0-1637129560464.png

Custom rules:

Use parameters to display the top N names, and calculate how many IDs the top N names in each group have.

Here are the steps you can follow:

1. Modeling – New parameter.

 

vyangliumsft_1-1637129560468.png

2. Create measure.

rank = RANKX(ALL('CountTable'),CALCULATE(SUM('CountTable'[Amount])),,ASC)
count=
COUNTX(FILTER(ALL(CountTable),'CountTable'[group]=MAX('CountTable'[group])&&[rank]<=[Parameter Value]),[group])

3. Result:

vyangliumsft_2-1637129560471.png

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Vitor_sp_bo ,

Do you mean using the parameters in Power bi desktop to count, I have an example here

I created some data:

vyangliumsft_0-1637129560464.png

Custom rules:

Use parameters to display the top N names, and calculate how many IDs the top N names in each group have.

Here are the steps you can follow:

1. Modeling – New parameter.

 

vyangliumsft_1-1637129560468.png

2. Create measure.

rank = RANKX(ALL('CountTable'),CALCULATE(SUM('CountTable'[Amount])),,ASC)
count=
COUNTX(FILTER(ALL(CountTable),'CountTable'[group]=MAX('CountTable'[group])&&[rank]<=[Parameter Value]),[group])

3. Result:

vyangliumsft_2-1637129560471.png

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

VahidDM
Super User
Super User

Hi @Vitor_sp_bo 

 

Can you post sample data as text and expected output?
Not enough information to go on;

please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.