Forum Discussion

Mjolnir's avatar
Mjolnir
Helper I
2 years ago
Solved

Calculation items removes Web URL from values - how to fix?

Hi,

 

My measure "Actuals" returns values from the general ledger. My measure "Web URL" is used to conditionally format the "Actuals" measure to retrieve the invoice link.

This works perfect, but when the calculation group with scenarios, such as actuals, budget and early warnings are selected in a slicer - the Web URL disappears from the values, when unselected - the Web URL returns.

Can someone help me understand and fix this problem? I want the values to always contain the Web URL.

 

Web URL = 

 IF (  ISFILTERED ( fact_table[verificationnumber] ), 

CALCULATE (  MAX ( dim_links[URL] ), 

 dim_organization[orgcode] = SELECTEDVALUE ( dim_organization[orgcode] ), 

 dim_calendar[year] = SELECTEDVALUE ( dim_calendar[year] ), 

 FILTER ( fact_table, fact_table[verificationnumber] 

 IN VALUES ( fact_table[verificationnumber] ) ) ), 

 BLANK () )

 

Actuals = SUM(fact_table[actuals])

 

 Calc Item Actuals = IF( 

 CONTAINSSTRING(SELECTEDMEASURENAME(), "Actuals"), 

 SELECTEDMEASURE(), 

 BLANK() )

 

  • Mjolnir's avatar
    Mjolnir
    2 years ago

    Again, really appreciate your effort - though the problem still remained.

     

    So the problem seemed to be related to the calculation item "Actuals", that returns blank when the selected measure name does not contain "actuals". So the Web URL measure was simply set to blank as its name does not contain "actuals" in it.

     

    So I tried to to change the calculation item telling it to return the selected measure when the selected measure name either contain "Actuals" or "Web URL" - and it works now!

    Calculation item changed to...

    Actuals=
    IF (
        CONTAINSSTRING(SELECTEDMEASURENAME(), "Actuals") ||
        CONTAINSSTRING(SELECTEDMEASURENAME(), "Web URL"),
        SELECTEDMEASURE(),
        BLANK()
    )

5 Replies

  • ahadkarimi's avatar
    ahadkarimi
    Solution Specialist

    Hi Mjolnir, try these measures below, and if you encounter any issues, let me know.

    Web URL = 
    IF (
        ISFILTERED(fact_table[verificationnumber]), 
        CALCULATE (
            MAX(dim_links[URL]),
            dim_organization[orgcode] = SELECTEDVALUE(dim_organization[orgcode]),
            dim_calendar[year] = SELECTEDVALUE(dim_calendar[year]),
            FILTER (
                fact_table, 
                fact_table[verificationnumber] IN VALUES(fact_table[verificationnumber])
            )
        ), 
        IF (
            ISSELECTEDMEASURE(Actuals),  // Ensure it applies to the "Actuals" measure
            CALCULATE (
                MAX(dim_links[URL]),
                dim_organization[orgcode] = SELECTEDVALUE(dim_organization[orgcode]),
                dim_calendar[year] = SELECTEDVALUE(dim_calendar[year]),
                FILTER (
                    fact_table, 
                    fact_table[verificationnumber] IN VALUES(fact_table[verificationnumber])
                )
            ), 
            BLANK()
        )
    )
    Calc Item Actuals = 
    IF (
        CONTAINSSTRING(SELECTEDMEASURENAME(), "Actuals"), 
        SELECTEDMEASURE(), 
        BLANK()
    )

    Did I answer your question? If so, please mark my post as the solution! ✔️
    Your Kudos are much appreciated! Proud to be a Solution Supplier!

    • Mjolnir's avatar
      Mjolnir
      Helper I

      Dear ahadkarimi ,

      Appreciate your effort. The suggested measures did not solve the issue. When the calculation item is selected and filtered in the report slicer, the URL disappears from the values. The values though, are still shown.

      • Mjolnir's avatar
        Mjolnir
        Helper I

        Additional information, when calculation item "Actuals" is selected the URL disappears, BUT when multiple selections are made the URL returns, for example when "Budget" is added to the selection.

        Budget =
        IF(
            CONTAINSSTRING(
                SELECTEDMEASURENAME(), "Budget"),
                CALCULATE(
                SELECTEDMEASURE(),
                facts_budget[scenario] = "Budget"),
            BLANK()
        )