Forum Discussion

Excellove15's avatar
Excellove15
Iron Contributor
Mar 06, 2024
Solved

Finding values from related tables for Dax and Field parameter values not shown

Hi SergeiBaklan ,   I have 2 queries here:   1st Query: I have 2 field parameters that filters a visual like below: The one field parameter acts as a main and other acts as sub. Main wil...
  • SergeiBaklan's avatar
    Mar 10, 2024

    Excellove15 

    As for the first part. When we select Category Main (Budget or Target or Nothing)  we pick-up all categories related to selected main. Thus for the Budget or Target list of categories finally applied for filtering is {Unit, Cost}. There is no Carbon in such list, it appears only Main is not filtered.

    With first case filtered Parameter table is empty, Carbon is not selectable and result is blank.

    In general, for Carbon calculating we need to remove filter context from Category Main.

    In case of parameter table we can't remove shadow filter content since internally DAX makes grouping and we can't get content from the column grouped by other column.

    As workaround we may modify ShowValues as

    VAR SelectedParameter =
        SELECTEDVALUE ( 'Parameter 3'[Category] )
    VAR nRows = COUNTROWS('Parameter 3')+0
    VAR Result =
        SWITCH (
            SelectedParameter,
            "Units", SUM ( DataInvoice[Units] ),
            "Cost", SUM ( DataInvoice[Cost] ),
            "Carbon", [Carbon tCO2e]
        )
    RETURN
        IF(nRows = 0, [Carbon tCO2e], Result )

    However, not very reliable from maintenance point of view if we will be modifying parameters configuration.

    See results on Page 3

    File is here TechComm - OneDrive (live.com)

Resources