Forum Discussion

JothiG's avatar
JothiG
Icon for Helper III rankHelper III
1 year ago
Solved

Dax not working

Tooltip screen must capture mouse hovering value from main visual and show it .

how to write Dax for this.
Ex:

Tooltip must capture both the Ageing bucket (Above 6 months) and the Year (2022) from the main chart.

Then it should calculate and display %GT stock balance (Age) for that exact combination.

%GT_stock_bal_age_Label =
COALESCE(SELECTEDVALUE(Stock_dtl[Ageing]), "No Age")
& " , " &
COALESCE(SELECTEDVALUE(Stock_dtl[Stock_year]), "No Year")
 
%GT_Stock Balance_Age =
DIVIDE(
    SUM(Stock_dtl[Net_sales]),
    CALCULATE(SUM(Stock_dtl[Net_sales]), ALL(Stock_dtl[Ageing]))
)  --These not working
  • I see, the issue is not comming from the dax, but the kind of visual you are using

     

    I converted my bar chart into a line charet, and now it is not working

    It is related to how the tooltip is working with a line chart, the standard tooltip returns all values for a specific data, so here it doesn't understand what it has to return

     

    The only workaround (I found), it is to use another visual

4 Replies

  • Hi JothiG 

     

    Is it something like that you need to achieve ?

     

    This is the dummy dataset I created

    Above 6 months2023Above 6 months202310000

    Ageing Stock_year Net_sales
    Less than 1 month 2022 10000
    Less than 1 month 2023 5000
    1-3 months 2022 5000
    1-3 months 2023 30000
    3-6 months 2022 15000
    3-6 months 2023 10000
    Above 6 months 2022 20000
    Above 6 months 2023 40000
         

     

    I called my table data and I created two measures

    % GT Stock Balance (Age) =
    VAR Total =
    CALCULATE(
        SUM(Data[Net_sales]),
        ALL(Data[Ageing])
    )
    RETURN
    DIVIDE(
        SUM(data[Net_sales]),
        Total
    )
     
    %GT_stock_bal_age_Label =
    COALESCE(SELECTEDVALUE(Data[Ageing]), "No Age")
    & " , " &
    COALESCE(SELECTEDVALUE(Data[Stock_year]), "No Year")
     
    Then I created a new page, I set up as a tooltip

     

    I add the two measure on this page and in the bar chart, I select my page 2 as a tooltip

     

    If it is not what you are trying to achieve, can you share some dummy data and a clear scenario?

    • JothiG's avatar
      JothiG
      Icon for Helper III rankHelper III
      Net_salesStock_yearStock_monthStock_month_nameFin_yearPeriodAgeing
      80788.3820244Apr2024Q1Below 3 month
      1405697.8220244Apr2024Q1Below 3 month
      280119033.5220244Apr2024Q1Below 3 month
      1433529.4520244Apr2024Q1Below 3 month
      76278.3520244Apr2024Q1Below 3 month
      51907.2620244Apr2024Q1Below 3 month
      44793496.1920244Apr2024Q1Below 3 month
      282460.0520244Apr2024Q1Below 3 month
      616680.5920244Apr2024Q1Below 3 month
      22809080.8320244Apr2024Q1Below 3 month
      389015.5520245May2024Q1Below 3 month
      218655.920245May2024Q1Below 3 month
      628000.5620245May2024Q1Below 3 month
      296772145.5220245May2024Q1Below 3 month
      1440319.820245May2024Q1Below 3 month
      4613.4820245May2024Q1Below 3 month
      7619.1520245May2024Q1Below 3 month
      60653491.8720245May2024Q1Below 3 month
      204911.0520245May2024Q1Below 3 month
      261303.520245May2024Q1Below 3 month

       

       

       

      • Cookistador's avatar
        Cookistador
        Icon for Super User rankSuper User

        I see, the issue is not comming from the dax, but the kind of visual you are using

         

        I converted my bar chart into a line charet, and now it is not working

        It is related to how the tooltip is working with a line chart, the standard tooltip returns all values for a specific data, so here it doesn't understand what it has to return

         

        The only workaround (I found), it is to use another visual