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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shantupm5
Helper III
Helper III

Create title from a result out of existing Measure!

Hello, 

 

Please help me with a measure to auto populate the Title. 

Requirement is, i have a output result which is from existing Measure. It is as below. 

I need to get the Title which has Maximum Cost Per Travel from the existing Measure , and the title should be Title = "Maximum Cost per Travel by Customer CD".  

 

 

 Cost Per Travel
Customer AB$100
Customer BC$200
Customer CD$500
Customer DE$50
3 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

This measure should work

Measure = "Maximum cost per travel by " & CONCATENATEX(TOPN(1,Customers,[Cost per travel]),Customers[Customer Name],", ")

I have assumed the following

  1. Cost per travel is a measure that you have written
  2. Customer is a Table with Customer Name as a column in it.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

This measure works

Measure = "Least cost per order Customer is "&" "&CONCATENATEX(TOPN(1,VALUES(Data[Customer]),[CPO],ASC),Data[Customer])

Hope this helps.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

Does this measure work?

measure= "Least cost per order Customer is " & CONCATENATEX(TOPN(1,FILTER(VALUES(Data[Customer]),[CPO]>0),[CPO],ASC),Data[Customer])

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

20 REPLIES 20
Ashish_Mathur
Super User
Super User

Hi,

This measure should work

Measure = "Maximum cost per travel by " & CONCATENATEX(TOPN(1,Customers,[Cost per travel]),Customers[Customer Name],", ")

I have assumed the following

  1. Cost per travel is a measure that you have written
  2. Customer is a Table with Customer Name as a column in it.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Many thanks, this is working. 

Similarly do we have a dax which can also show me 

1) Min value from an existing measure

2) Meadian value from an existing measure.

 

Your guidance will be highly appriciable.

 

Regards

Prsahnth

You are welcome.  If my previous reply helped, please mark that reply as Answer.

The Cost of travel measure should be modified.  Use the MIN and MEDIAN functions instead of SUM.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

From the solution you provided which helped me to identify the Top drivers

CONCATENATEX(TOPN(1,Customers,[Cost per travel]),Customers[Customer Name],", ")

 

 

Similar to about (TOPN) function, do we also have any function to identify bottom drivers and median drivers?

Hi,

One of the inputs of the TOPN function is the sort order.  Give that as ascending.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

I gave ASC order command but getting below error

 

shantupm5_0-1689591276374.png

 

Read about the TOPN function here - TOPN function (DAX) - DAX | Microsoft Learn.  The fourth argument is important.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

I an still not able to figure out a solution for this dax. Please can you help me with an example?

 

Regards

Prashanth

Hi,

Share some data (in a format that can be pasted in an MS Excel file) and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Here is some raw data.

 

With the belowformula i am able to arrive the top first customer 

"Best-In-Class for Cost Per Order is "&" "&CONCATENATEX(TOPN(1,'Master file xlsx',[Cost Per Order]),'Master file xlsx'[Customer])

 

Similary the requirement is to pick the customer who is at least of cost per order (Customer-1 in the below example. Please advice

 

CustomerCost Per Order
Customer-1$45
Customer-2$55
Customer-3$65
Customer-4$75
Customer-5$85
Customer-6$95
Customer-7$145
Customer-8$545
Customer-9$845

Hi,

This measure works

Measure = "Least cost per order Customer is "&" "&CONCATENATEX(TOPN(1,VALUES(Data[Customer]),[CPO],ASC),Data[Customer])

Hope this helps.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello Ashish

The below measure is working well for me, but i am seeing another challange now.

The column [CPO] has few customers who's data is blank.

Hence the Measure is pulling all the customers name who's data is blank.

I tried IFBLANK function and its not working for me. Below is the measure i tried.

 

Measure = IF(ISBLANK(CPO),BLANK(),"Least cost per order Customer is "&" "&CONCATENATEX(TOPN(1,VALUES(Data[Customer]),[CPO],ASC),Data[Customer])

 Please guide

 

 

Measure = "Least cost per order Customer is "&" "&CONCATENATEX(TOPN(1,VALUES(Data[Customer]),[CPO],ASC),Data[Customer])

 

Hi,

Share the download link of the PBI file and show the problem and expected result clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish

Sorry, i will not be able to share the PBI file due to security concerns.

Here is the issue, below table has 3 customers whos CPO data is blank.

 

CustomerCPO
Customer-1$45
Customer-2$55
Customer-3$65
Customer-4$75
Customer-5$85
Customer-6$95
Customer-7$145
Customer-8$545
Customer-9$845
Customer-10 
Customer-11 
Customer-12 

 

Earlier you suggested the measure below which we used tp identify the customer who has the least Cost per order. But since we have the blank customer with no data (Blank cells), the measure we used is actully showing all the customers who has blank data instead of actual customer who has least cost per order.

 

the measure se used (measure: "Least cost per order Customer is "&" "CONCATENATEX(TOPN(1,VALUES(Data[Customer]),[CPO],ASC),Data[Customer])

 

As a solution i tried using IF(ISBLANK) funtion but it did not work. 

IF(ISBLANK(CPO),BLANK(),"Least cost per order Customer is "&" "&CONCATENATEX(TOPN(1,VALUES(Data[Customer]),[CPO],ASC),Data[Customer])

 

Please advice

 

Regards

Prashanth

 

 

Hi,

Does this measure work?

measure= "Least cost per order Customer is " & CONCATENATEX(TOPN(1,FILTER(VALUES(Data[Customer]),[CPO]>0),[CPO],ASC),Data[Customer])

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello Ashish,

 

Thank you so much and you are been genius all this while and helpful.

So kind of you 🙂

 

This measure worked too 🙂

 

Regards

Prashanth

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

This helped, thanks a lot Ashish 🙂

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ritaf1983
Super User
Super User

Hi @shantupm5 
If I understand you correctly and you need to return the title for the customer with maximum cost, then:

1. Create a measure finding this customer:

MaxCostCustomerByCost =
    VAR MaxCost =
        MAX('table'[Cost Per Travel])
    RETURN
        CALCULATE(
            FIRSTNONBLANK('table'[Customer], 1),
            'table'[Cost Per Travel] = MaxCost,
            DISTINCT('table'[Customer])
        )
Ritaf1983_0-1686966074955.png

2. Create measure with text for your title:

Title = "Maximum Cost per Travel by " &[MaxCostCustomerByCost]
Ritaf1983_1-1686966328217.png

3 . Use your title measure wherever you need

Ritaf1983_2-1686966534458.png

Link to a Sample File 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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