Forum Discussion

Rich_Wyeth's avatar
Rich_Wyeth
Helper I
1 year ago
Solved

Measures Creating Error

Hi all,   I have a dataset that holds details on Invoices, and Quotes. I have taken the company name into a table and then I have added the following measure for Quotes:  M_CurrentQuotes = CALCUL...
  • v-nmadadi-msft's avatar
    v-nmadadi-msft
    1 year ago

    Hi Rich_Wyeth ,
    To ensure that the two measures (M_CurrentQuotes and M_CurrentInvoices) work correctly together in the same visual, follow these best practices:

    Use FILTER() to Apply Row-Based Logic

    FILTER() enables row-wise evaluation of conditions (e.g., checking if a field is a quote or an invoice).

    This ensures a valid row context for the CALCULATE() function to operate correctly.

    Using Boolean functions like ISTEXT() or ISBLANK() directly in CALCULATE() without FILTER() can create ambiguous or invalid filter contexts, especially when used in visuals with multiple measures.

     

    Isolate Time Intelligence Logic:


    Use variables to define the required time period (e.g.,VAR LastMonth = MONTH(TODAY()) - 1), and apply the logic through a separate FILTER() on the Date table.

    For robust and dynamic time calculations, prefer built-in DAX time intelligence functions such as:

    DATESINPERIOD(),  DATEADD(), SAMEPERIODLASTYEAR()

    These functions handle date transitions (e.g., across year boundaries) and maintain compatibility with visuals and slicers that rely on date hierarchies.


    If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
    Thank you