Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

IFERROR

Hi All,

 

I am trying to use the IFERROR in DAX. 

 

This is the formula I have used for Recommended Daily Usage Type.

 

Recommended Daily Usage Type = IFERROR(LOOKUPVALUE('Daily Usage Type'[Proposed Daily Usage],'Daily Usage Type'[PartPlantbyYearWeekNum],'Master Data Hygiene (2)'[PartPlantbyYearWeekNum]),'Master Data Hygiene (2)'[Daily Usage Type])

 

I do not understand why I have blank spaces. Is it not supposed to be the same as Daily Usage Type?

 

If the usage of the formula is incorrect, how can I get the same values as Daily usage type in the blank spaces of Recommended Daily Usage Type?

 

 

Any help would be appreciated!

Thank you!

 

  • selimovd's avatar
    selimovd
    5 years ago

    Hey Anonymous ,

     

    then that's not an error. You can check if it's blank to return the Usage Type and otherwise the lookup value.

    Try the following measure:

    Recommended Daily Usage Type =
    VAR vLookupValue =
        LOOKUPVALUE(
            'Daily Usage Type'[Proposed Daily Usage],
            'Daily Usage Type'[PartPlantbyYearWeekNum], 'Master Data Hygiene (2)'[PartPlantbyYearWeekNum]
        )
    RETURN
        IF(
            vLookupValue = BLANK(),
            'Master Data Hygiene (2)'[Daily Usage Type],
            vLookupValue
        )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     

     

6 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey Anonymous ,

     

    your formula is doing the following:

    You are searching for the value of 'Master Data Hygiene (2)'[PartPlantbyYearWeekNum] in the column 'Daily Usage Type'[PartPlantbyYearWeekNum] and then return from the same row the value from 'Daily Usage Type'[Proposed Daily Usage].

     

    If there is no match you return the value of 'Master Data Hygiene (2)'[Daily Usage Type].

     

    I guess the value of Daily Usage Type'[Proposed Daily Usage] or 'Master Data Hygiene (2)'[Daily Usage Type] are blank. Maybe you can take a specific row and really check in detail what the function is doing.

     

    If you share the file, I can also try to help you with that.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi selimovd ,

      Thank you!

       

      Yes. For some PartPlantbyYearWeekNum, the Proposed Daily usage type is blank. i.e., Daily Usage Type'[Proposed Daily Usage] is blank.

      And hence, for the blank rows, I want the same values to be copied in Daily Usage type.

      For eg: In the image above, In 3rd row, Recommended Daily usage is blank. So, I want it be ADU. Same as that of Daily Usage type.

      • selimovd's avatar
        selimovd
        Most Valuable Professional

        Hey Anonymous ,

         

        then that's not an error. You can check if it's blank to return the Usage Type and otherwise the lookup value.

        Try the following measure:

        Recommended Daily Usage Type =
        VAR vLookupValue =
            LOOKUPVALUE(
                'Daily Usage Type'[Proposed Daily Usage],
                'Daily Usage Type'[PartPlantbyYearWeekNum], 'Master Data Hygiene (2)'[PartPlantbyYearWeekNum]
            )
        RETURN
            IF(
                vLookupValue = BLANK(),
                'Master Data Hygiene (2)'[Daily Usage Type],
                vLookupValue
            )

         

        If you need any help please let me know.
        If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
         
        Best regards
        Denis