locked
Create measure that returns text from a column RRS feed

  • Question

  • Hello friends, need your help:

    My table contains the following columns:

    TransactionID (PK), Amount, ProductID, StoreID, CustomerName

    How do I create a Measure that returns CustomerName (as a text) in Pivot when I put TransactionID on rows?

    I want it to be a Measure.

    I do know that DAX measures can return text, but all the samples that I've found on the Web are of a kind:

    =IF(Some Condition,"Text","Another Text")

    What I need is that the Measure returns specific CustomerName for each Transaction (and null for Totals)

    Thanks,

    Michael


    Michael

    Monday, March 9, 2015 2:29 PM

Answers

  • Hi Michael,

    try this:

    :=IF(COUNTROWS(VALUES(table[CustomerName])) > 1; BLANK(); VALUES(table[CustomerName])


    Imke

    • Marked as answer by M. Shparber Wednesday, March 11, 2015 12:02 PM
    Tuesday, March 10, 2015 9:09 PM
    Answerer

All replies

  • Hi Michael,

    try this:

    :=IF(COUNTROWS(VALUES(table[CustomerName])) > 1; BLANK(); VALUES(table[CustomerName])


    Imke

    • Marked as answer by M. Shparber Wednesday, March 11, 2015 12:02 PM
    Tuesday, March 10, 2015 9:09 PM
    Answerer
  • Great! Thanks, Imke, it did the job!

    Michael

    Wednesday, March 11, 2015 12:06 PM
  • Dear Imke!

    Thank you very much for the reply but in my case solution you provided gives me #ERROR output.

    Could you please tell me what's the case.

    Thank you.

    Thursday, November 22, 2018 9:52 AM
  • Sorry for disturbance, I found the answer. The case is that Table name should be written as well.
    Saturday, December 1, 2018 5:06 PM