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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Zael-Leonhart
Helper II
Helper II

help with Qlik to Dax

Hi Experts, 

 

I would like to ask to convert this Qlik expression to DAX. Thanks

 

sum(aggr(count(distinct [Customer]),[Customer]))

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

Certainly! The Qlik expression you provided involves aggregation functions, and in DAX (Data Analysis Expressions), you can achieve similar results using the SUMX and DISTINCTCOUNT functions. Here's the equivalent DAX expression

 

SUMX(
VALUES('YourTableName'[Customer]),
CALCULATE(
DISTINCTCOUNT('YourTableName'[Customer])
)
)

 

Replace 'YourTableName' with the actual name of your table in your Power BI or other DAX-compatible tool.

Explanation:

  • VALUES('YourTableName'[Customer]): This function returns a table that contains the unique values of the [Customer] column.
  • DISTINCTCOUNT('YourTableName'[Customer]): This function calculates the distinct count of customers within the current context.
  • CALCULATE(): This function modifies the context in which the expression is evaluated, allowing you to use the DISTINCTCOUNT within the context of the specified table.

The SUMX function then iterates through each row of the table created by VALUES('YourTableName'[Customer]) and sums up the distinct count for each customer.

Make sure to replace 'YourTableName' with the actual name of your table and [Customer] with the actual name of your customer column.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

Certainly! The Qlik expression you provided involves aggregation functions, and in DAX (Data Analysis Expressions), you can achieve similar results using the SUMX and DISTINCTCOUNT functions. Here's the equivalent DAX expression

 

SUMX(
VALUES('YourTableName'[Customer]),
CALCULATE(
DISTINCTCOUNT('YourTableName'[Customer])
)
)

 

Replace 'YourTableName' with the actual name of your table in your Power BI or other DAX-compatible tool.

Explanation:

  • VALUES('YourTableName'[Customer]): This function returns a table that contains the unique values of the [Customer] column.
  • DISTINCTCOUNT('YourTableName'[Customer]): This function calculates the distinct count of customers within the current context.
  • CALCULATE(): This function modifies the context in which the expression is evaluated, allowing you to use the DISTINCTCOUNT within the context of the specified table.

The SUMX function then iterates through each row of the table created by VALUES('YourTableName'[Customer]) and sums up the distinct count for each customer.

Make sure to replace 'YourTableName' with the actual name of your table and [Customer] with the actual name of your customer column.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.