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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ribs
Helper I
Helper I

grouping measures with different conditions to appear in a single column

I have a set of measures which basically calculates the count of orderid  but the conditions are different which gives actuals. So I have created three different measures which form three different columns. Instead I need all of them to show up in one column, I am new to DAX and need your help here. Thank you in advance

My Table:

Sending TypeTotal Order CountExpressExpress 10:00Express 12:00
Express10010  
Express 10:0020 20 
Express 12:0030  30
     

 

 

Express = CALCULATE(count(Query1[Orderno]); filter(Query1; format(Query1[DEL];"hh:mm") <= "18:00") ; FILTER(Query1;Query1[OUB]<= 24); FILTER(Query1;Query1[Sending]= "EXPRESS")) 
Express 10 = CALCULATE(count(Query1[Orderno]); filter(Query1; format(Query1[DEL];"hh:mm") <= "10:00") ; FILTER(Query1;Query1[OUB]<= 24); FILTER(Query1;Query1[Sending]= "EXPRESS 10")) 

 

Expected Output:

 

Sending TypeTotal Order CountExpress
Express100100
Express 10:002020
Express 12:003030

 

 

 

1 ACCEPTED SOLUTION
v-bmanikante
Community Support
Community Support

Hi @ribs ,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

@bhanu_gautam Thank you for your response.

 

To display all your different order count measures (like Express, Express 10:00, and Express 12:00) in a single column, you can use a disconnected table and a SWITCH measure.

 

Create a calculated table for your sending types:

 

SendingTypes = DATATABLE(
    "Sending Type", STRING,
    {
        {"Express"},
        {"Express 10:00"},
        {"Express 12:00"}
    }
)

 

Then, Create a dynamic measure using SWITCH:

 

Dynamic OrderCount =
SWITCH(
    SELECTEDVALUE(SendingTypes[Sending Type]),
    "Express", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "18:00" && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS")),
    "Express 10:00", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "10:00" && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS 10")),
    "Express 12:00", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "12:00" && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS 12"))
)

 

Use a matrix or table visual in Power BI with:

SendingTypes[Sending Type] as rows

Dynamic OrderCount as values

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!

 

Regards,

B Manikanteswara Reddy

View solution in original post

5 REPLIES 5
ribs
Helper I
Helper I

Yes It worked! Thanks!

v-bmanikante
Community Support
Community Support

Hi @ribs ,

 

We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

 

If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

B Manikanteswara Reddy

v-bmanikante
Community Support
Community Support

Hi @ribs ,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

@bhanu_gautam Thank you for your response.

 

To display all your different order count measures (like Express, Express 10:00, and Express 12:00) in a single column, you can use a disconnected table and a SWITCH measure.

 

Create a calculated table for your sending types:

 

SendingTypes = DATATABLE(
    "Sending Type", STRING,
    {
        {"Express"},
        {"Express 10:00"},
        {"Express 12:00"}
    }
)

 

Then, Create a dynamic measure using SWITCH:

 

Dynamic OrderCount =
SWITCH(
    SELECTEDVALUE(SendingTypes[Sending Type]),
    "Express", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "18:00" && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS")),
    "Express 10:00", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "10:00" && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS 10")),
    "Express 12:00", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "12:00" && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS 12"))
)

 

Use a matrix or table visual in Power BI with:

SendingTypes[Sending Type] as rows

Dynamic OrderCount as values

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!

 

Regards,

B Manikanteswara Reddy

ribs
Helper I
Helper I

@bhanu_gautam 

After this statement
Combined Express =
SWITCH(
TRUE(),

it is not allowing to choose the columns from the table except for measures. The auto suggested columns show only measures

 

bhanu_gautam
Super User
Super User

@ribs Create a new calculated column that will hold the combined measure values based on the conditions.

DAX
Combined Express =
SWITCH(
TRUE(),
Query1[Sending Type] = "Express", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "18:00") && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS"),
Query1[Sending Type] = "Express 10:00", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "10:00") && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS 10"),
Query1[Sending Type] = "Express 12:00", CALCULATE(COUNT(Query1[Orderno]), FILTER(Query1, FORMAT(Query1[DEL], "hh:mm") <= "12:00") && Query1[OUB] <= 24 && Query1[Sending] = "EXPRESS 12"),
BLANK()
)

 

Use this new column in your table to display the combined measure values in a single column.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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