Forum Discussion

srlabhe's avatar
srlabhe
Icon for Super User rankSuper User
8 months ago
Solved

Data to be merged on Visual Level

Hi I have query which is pulling data from a view. Now based on Start and End Date selection I want data to be displayed as "Required Result" below

Please note I will have two slicres on to select Start Date and End Date and based on selectein it should goto data and have "Required Result" to display with new column Change.

The data for Start Date and End Date are not supoposed to be part of report but just for your undersatnding whats data for those selected dates

Appreciate your help 

  • Hi srlabhe ,

     

    Thank you for your follow-up. The visual appearing blank in this scenario is expected and not an issue with Fabric or Power BI. This happens because the ChangeLabel measure uses SELECTEDVALUE from both the start and end date slicers. If either slicer doesn't have a single date selected, SELECTEDVALUE returns blank, making the measure blank for all rows and causing the table visual to appear empty. This only occurs after the measure is added.

    To address this, use disconnected date tables for the start and end date slicers. If the slicers are connected to the main table, data is filtered out before the measure runs, preventing it from accurately determining if a record is new, deleted, modified, or unchanged between snapshots. Disconnected slicers keep the full dataset visible, allowing the measure to compare the two dates directly.

    It's also important that the measure never returns blank. It should handle cases where one or both slicers aren't selected and return a meaningful value, so the visual stays visible. When both dates are selected, the measure can then determine the status of each ID. This approach keeps the table from disappearing.

    If you want to let users filter by change type (like New or Modified), use a separate measure as a visual level filter instead of relying on the label measure alone. This way, the table remains populated even if no change type is selected.

    Thank you.

15 Replies

  • srlabhe please change the name of table from ICPL3 to your table.

    1. Model Assumption:

    Date (Snapshot date used by slicer), ID, Name, idnamekey (your comparison key or concatenation)

    You also have: 
    Start Date slicer

    End Date slicer

    Both slicers filter the same Date column from your view or a Date dimension.

     

    2. Capture Slicer values:

    create these two measures:

    Start Selected Date =
    MIN ( 'Date'[Date] )

    End Selected Date =
    MAX ( 'Date'[Date] )

     

    3. Base Lookup measures:

    this verifies if a row exits

    exists at start:

    Exists at Start =
    VAR _Start = [Start Selected Date]
    RETURN
    CALCULATE (
    COUNTROWS ( ICPL3 ),
    ICPL3[Date] = _Start
    )

    exists at end

    Exists at End =
    VAR _End = [End Selected Date]
    RETURN
    CALCULATE (
    COUNTROWS ( ICPL3 ),
    ICPL3[Date] = _End
    )

    4. Detect modification

    Key At Start =
    VAR _Start = [Start Selected Date]
    RETURN
    CALCULATE (
    MAX ( ICPL3[idnamekey] ),
    ICPL3[Date] = _Start
    )

     

    Key At Start =
    VAR _Start = [Start Selected Date]
    RETURN
    CALCULATE (
    MAX ( ICPL3[idnamekey] ),
    ICPL3[Date] = _Start
    )

     

    5. Final measure - Required column "Change" 

     

    Change Status :=
    VAR _StartExists = [Exists at Start] > 0
    VAR _EndExists = [Exists at End] > 0
    VAR _StartKey = [Key At Start]
    VAR _EndKey = [Key At End]
    RETURN

    SWITCH (
    TRUE(),

    -- Record added in End Snapshot
    NOT _StartExists && _EndExists,
    "New",

    -- Record removed from End Snapshot
    _StartExists && NOT _EndExists,
    "Deleted",

    -- Present in both but data changed
    _StartExists && _EndExists && _StartKey <> _EndKey,
    "Modify",

    -- Present in both and unchanged
    _StartExists && _EndExists,
    "No Change",

    BLANK()
    )

    6. Build the visual

    Column for table:

    ID, Name, idbamekey, Change Status

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

      Thanks for you rreply , is it possible to have Change Status as column instead, so that I can filter on it 

  • For Interactive & filterable Change column, do below steps:
    1) Create disconnected date slicer tables

    (If you already have date tables used elsewhere, create two tiny disconnected tables just for the slicers.)

    Modeling → New table:

    StartDate = CALENDAR( DATE(2015,1,1), DATE(2030,12,31) )
    EndDate = CALENDAR( DATE(2015,1,1), DATE(2030,12,31) )

    Or create them however you prefer.

    2) Create simple ChangeType table (for slicer)

    Modeling → New table:

    ChangeType = DATATABLE("Change", STRING, { {"New"}, {"Deleted"}, {"No Change"}, {"Modify"} })

    Put a slicer on ChangeType[Change].

    3) Add the main measure: ChangeLabel

    Create a measure in your model (adjust names to match your table/columns; I use YourView, SnapshotDate, ID, idnamekey — replace as needed):

    ChangeLabel =
    VAR vStart = SELECTEDVALUE( StartDate[Date] )
    VAR vEnd = SELECTEDVALUE( EndDate[Date] )
    VAR vID = SELECTEDVALUE( 'YourView'[ID] )

    // Determine presence in Start/End snapshots
    VAR inStart =
    CALCULATE(
    COUNTROWS( 'YourView' ),
    ALL( 'YourView' ),
    'YourView'[SnapshotDate] = vStart,
    'YourView'[ID] = vID
    ) > 0

    VAR inEnd =
    CALCULATE(
    COUNTROWS( 'YourView' ),
    ALL( 'YourView' ),
    'YourView'[SnapshotDate] = vEnd,
    'YourView'[ID] = vID
    ) > 0

    // Grab the idnamekey or comparable value to detect change
    VAR startKey =
    CALCULATE(
    MAX( 'YourView'[idnamekey] ),
    ALL( 'YourView' ),
    'YourView'[SnapshotDate] = vStart,
    'YourView'[ID] = vID
    )

    VAR endKey =
    CALCULATE(
    MAX( 'YourView'[idnamekey] ),
    ALL( 'YourView' ),
    'YourView'[SnapshotDate] = vEnd,
    'YourView'[ID] = vID
    )

    RETURN
    SWITCH(
    TRUE(),
    inEnd && NOT inStart, "New",
    inStart && NOT inEnd, "Deleted",
    inStart && inEnd && endKey = startKey, "No Change",
    inStart && inEnd && endKey <> startKey, "Modify",
    BLANK()
    )

    Notes:
    >> ALL('YourView') removes the visual filter so the measure can explicitly target the SnapshotDate rows.
    >> If idnamekey may be BLANK or duplicates exist, you can change the aggregation used (e.g., CONCATENATEX or other logic).
    >> Replace 'YourView' and column names with your actual table & column names.

    4) Add filter measure: IsInSelectedChange

    Create this measure and use it as a visual-level filter (set to is 1) on your table visual.

    IsInSelectedChange =
    VAR selChange = SELECTEDVALUE( ChangeType[Change] ) // value selected in ChangeType slicer
    VAR rowChange = [ChangeLabel] // the computed change label for the row
    RETURN
    IF(
    ISBLANK(selChange) || ISBLANK(rowChange),
    1, // if no change selected or row has no label, keep it visible
    IF(rowChange = selChange, 1, 0)
    )

    Final Fix:

    >> Put ID, Name, idnamekey (or whatever columns) into a table visual.
    >> Add the ChangeLabel measure into the visual (so it shows as a column).
    >> In the Visual → Filters area, add IsInSelectedChange and set it to is 1.
    >> Now the ChangeType slicer behaves like a normal filter — selecting New or Modify will filter the table to those rows.
    >> Show both Name_Start and Name_End if you want to display old vs new values — create them with CALCULATE(MAX(...), FILTER(...)) pulling from the Start and End snapshots like the logic used above.
    >> If you want to show a friendly message if Start/End not selected, show a card with IF(OR(ISBLANK(vStart), ISBLANK(vEnd)), "Please pick Start and End", ...).
    >> Make sure both StartDate/EndDate slicers are single-select (so the measures return a single date).

    =================================================================
    Did I answer your question? Mark my post as a solution! This will help others on the forum!

    Appreciate your Kudos!!

    Jaywant Thorat | MCT | Data Analytics Coach
    Linkedin: https://www.linkedin.com/in/jaywantthorat/


    Join #MissionPowerBIBharat = https://shorturl.at/5ViW9

    #MissionPowerBIBharat
    LIVE with Jaywant Thorat from 15 Dec 2025
    8 Days | 8 Sessions | 1 hr daily | 100% Free

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

      The step where I am adding Chang Lable measure in Table visual everything goes blank 

      • Jaywant-Thorat's avatar
        Jaywant-Thorat
        Icon for Super User rankSuper User

        Improvised Version

         

        Step 1 — Modify ChangeLabel to avoid full BLANK output:

        ChangeLabel =

        VAR vStart = SELECTEDVALUE(StartDate[Date])

        VAR vEnd = SELECTEDVALUE(EndDate[Date])

        VAR vID = SELECTEDVALUE('YourView'[ID])

         

        -- If slicers not selected, keep table visible

        IF(

        ISBLANK(vStart) || ISBLANK(vEnd),

        "Select dates",

        VAR inStart =

        CALCULATE(

        COUNTROWS('YourView'),

        ALL('YourView'),

        'YourView'[SnapshotDate] = vStart,

        'YourView'[ID] = vID

        ) > 0

         

        VAR inEnd =

        CALCULATE(

        COUNTROWS('YourView'),

        ALL('YourView'),

        'YourView'[SnapshotDate] = vEnd,

        'YourView'[ID] = vID

        ) > 0

         

        VAR startKey =

        CALCULATE(

        MAX('YourView'[idnamekey]),

        ALL('YourView'),

        'YourView'[SnapshotDate] = vStart,

        'YourView'[ID] = vID

        )

         

        VAR endKey =

        CALCULATE(

        MAX('YourView'[idnamekey]),

        ALL('YourView'),

        'YourView'[SnapshotDate] = vEnd,

        'YourView'[ID] = vID

        )

         

        RETURN

        SWITCH(

        TRUE(),

        inEnd && NOT inStart, "New",

        inStart && NOT inEnd, "Deleted",

        inStart && inEnd && endKey = startKey, "No Change",

        inStart && inEnd && endKey <> startKey, "Modify",

        "No Data"

        )

        )

         

        Step 2 — Add this measure for filtering:

        IsInSelectedChange =

        VAR sel = SELECTEDVALUE(ChangeType[Change])

        VAR row = [ChangeLabel]

         

        RETURN

        IF(

        ISBLANK(sel),

        1,

        IF(row = sel, 1, 0)

        )

         

        90% of the time, the reason is your StartDate or EndDate slicer has no selection → SELECTEDVALUE is blank → measure returns BLANK → visual disappears

        With the updated measure, this problem will solve permanently.

         

        =================================================================

        Did I answer your question? Mark my post as a solution! This will help others on the forum!

        Appreciate your Kudos!!

        Jaywant Thorat | MCT | Data Analytics Coach

        Linkedin: https://www.linkedin.com/in/jaywantthorat/

         

  • v-tejrama's avatar
    v-tejrama
    Icon for Community Support rankCommunity Support

    Hi srlabhe ,

    Thanks for reaching out to the Microsoft fabric community forum.

     

    The behavior you're seeing is expected with the current slicer selections and setup. When the Start Date is set to an earlier snapshot and the End Date to a later one where some names or IDs are missing, those records are correctly marked as Deleted. This shows the ChangeLabel logic is working as intended, since it checks for each ID's presence across the two selected snapshot dates rather than merging the data.

     

    As long as each slicer is in List mode with single select, the SnapshotDate column is of Date type, and the table visual includes the ID field for row context, your results are accurate. The solution meets both the original requirement and the follow-up scenario, so no further changes are needed unless you want to add more filtering or formatting.

    Please find the attached PBIX and Screenshort file for your reference.

     

     

    Best Regards,
    Tejaswi.
    Community Support

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

      Thanks but I want to use the change status column as slicer and being it as measure cant add in slicer. Any alternative for th esame?

      • v-tejrama's avatar
        v-tejrama
        Icon for Community Support rankCommunity Support

        Hi srlabhe ,

        This is expected behavior in Power BI, as measures cannot be directly used in slicers. To work around this, you can create a small, disconnected table listing change statuses such as New, Deleted, Modify, and No Change, and use it as the slicer. The slicer selection is matched to each row's calculated change result using a filtering measure.Applying this measure as a visual filter allows the slicer to function correctly while keeping the change logic dynamic. 


        Thank you.