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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
BieBel
Helper I
Helper I

Measure counting rows, grouped by two different colums

Hi,

I have al table with order information. I can easily create a visual showing me the number of ORDER_ID by SALES_REGION and by MONTH_OF_ORDER_DATE

But I need to create a measure that gives me this number of ORDER_ID by SALES_REGION and by MONTH_OF_ORDER_DATE because I have to use this in further calculations (productivity etc.)

And I cannot get it right. What would be the correct DAX formula?

 

ORDER_ID

ORDER_DATE

MONTH_OF_ORDER_DATE

AMOUNT_NET

VAT

SALES_REGION

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @BieBel 

 

DISTINCTCOUNT ('table'[ORDER ID] should be okay if the ID doesn't repeat in other region or months.  However, if the same ORDER ID can be re-used, try

COUNTROWS (  
    SUMMARIZE (
        -- Create a table of distinct combinations of the following columns:
        'table'[ORDER ID],           -- Unique order identifier
        'table'[SALES_REGION],       -- Region where the order was made
        'table'[MONTH_OF_ORDER_DATE] -- Month of the order date
    )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
v-pnaroju-msft
Community Support
Community Support

Thankyou, @rohit1991 and @danextian for your responses.

Hi BieBel,

We appreciate your inquiry submitted through the Microsoft Fabric Community Forum.

Based on our understanding of the scenario, we have attached a screenshot and a sample PBIX file that may help resolve the issue:

vpnarojumsft_0-1758136223007.png
We hope the information provided is helpful. If you have any further queries, please feel free to contact the Microsoft Fabric Community.

Thank you.

danextian
Super User
Super User

Hi @BieBel 

 

DISTINCTCOUNT ('table'[ORDER ID] should be okay if the ID doesn't repeat in other region or months.  However, if the same ORDER ID can be re-used, try

COUNTROWS (  
    SUMMARIZE (
        -- Create a table of distinct combinations of the following columns:
        'table'[ORDER ID],           -- Unique order identifier
        'table'[SALES_REGION],       -- Region where the order was made
        'table'[MONTH_OF_ORDER_DATE] -- Month of the order date
    )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
rohit1991
Super User
Super User

Hi @BieBel 

 

You can handle this easily with a measure. Just write:

Orders Count = DISTINCTCOUNT ( 'Orders'[ORDER_ID] )

This way you’ll always get the unique count of orders. When you drop SALES_REGION and MONTH_OF_ORDER_DATE into your visual, Power BI automatically applies the filter context so the measure shows the right number for each region and month. If every order ID is unique in your table you could also use COUNTROWS ( 'Orders' ), but using DISTINCTCOUNT is safer in case an order appears more than once. The good part is you don’t need to manually group anything—the visual and context do the grouping for you, so the measure stays simple and works in all scenarios.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Thanks, but I do not want to drop this measure in a visual. I need it for further calculation(s). danextian's solutions works for me.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors