Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mhsieh
Helper II
Helper II

Visuals not reacting to the Measure Filter that I defined using Numeric Range What-If Parameter

Hi everyone,

 

The Current Quarter CP % Filter is a slider filter that I created using the Modeling/What-If Paramater.

I want all the visuals to only show data for retailers having their most current Quarter-To-Date (QTD) 855_CP less than the value defined by the Current Quarter CP % Filter.

 

The matrix in the screenshot is correctly reflecting the Current Quarter CP % Filter; however, other visuals are not. Please see below screenshot for details.

 

mhsieh_0-1661631813128.png

mhsieh_1-1661631849095.png

 

Here is the a pbix file using the sample data (Drive). I would greatly appreciate your help! 

1 ACCEPTED SOLUTION

@mhsieh,

 

Try these measures. The filter logic is built into these measures, so no visual filter is required for the cards when using these measures.

 

Num of Retailers with Parameter = 
VAR vTableAccountMaxDate =
    ADDCOLUMNS (
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_ID] ),
        "@MaxDate", CALCULATE ( MAX ( Retailer_Compliance[Start of Month] ) )
    )
VAR vTableAmount =
    ADDCOLUMNS ( vTableAccountMaxDate, "@Amount", [855_CP_QTD] )
VAR vTableFilter =
    FILTER ( vTableAmount, [@Amount] < Parameter[Parameter Value] )
VAR vResult =
    CALCULATE (
        DISTINCTCOUNT ( Retailer_Compliance[SALESFORCE_ACCOUNT_ID] ),
        vTableFilter
    )
RETURN
    vResult
855_CP_QTD with Parameter = 
VAR vTableAccountMaxDate =
    ADDCOLUMNS (
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_ID] ),
        "@MaxDate", CALCULATE ( MAX ( Retailer_Compliance[Start of Month] ) )
    )
VAR vTableAmount =
    ADDCOLUMNS ( vTableAccountMaxDate, "@Amount", [855_CP_QTD] )
VAR vTableFilter =
    FILTER ( vTableAmount, [@Amount] < Parameter[Parameter Value] )
VAR vResult =
    CALCULATE ( [855_CP_QTD], vTableFilter )
RETURN
    vResult

 

DataInsights_0-1661703123217.png

 

DataInsights_1-1661703141200.png

 

I'm not sure regarding the question about making the constant line reflect the value defined in Current Quarter CP % Filter.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
mhsieh
Helper II
Helper II

Hello @DataInsights here is the new post followed by this thread: https://community.powerbi.com/t5/Desktop/Use-the-current-Quarter-To-Date-s-value-a-measure-and-make-...

 

Besides the question above, is there a way I can make the constant line reflect the value defined in Current Quarter CP % Filter?

 

mhsieh_0-1661633437032.png

 

@mhsieh,

 

Try these measures. The filter logic is built into these measures, so no visual filter is required for the cards when using these measures.

 

Num of Retailers with Parameter = 
VAR vTableAccountMaxDate =
    ADDCOLUMNS (
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_ID] ),
        "@MaxDate", CALCULATE ( MAX ( Retailer_Compliance[Start of Month] ) )
    )
VAR vTableAmount =
    ADDCOLUMNS ( vTableAccountMaxDate, "@Amount", [855_CP_QTD] )
VAR vTableFilter =
    FILTER ( vTableAmount, [@Amount] < Parameter[Parameter Value] )
VAR vResult =
    CALCULATE (
        DISTINCTCOUNT ( Retailer_Compliance[SALESFORCE_ACCOUNT_ID] ),
        vTableFilter
    )
RETURN
    vResult
855_CP_QTD with Parameter = 
VAR vTableAccountMaxDate =
    ADDCOLUMNS (
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_ID] ),
        "@MaxDate", CALCULATE ( MAX ( Retailer_Compliance[Start of Month] ) )
    )
VAR vTableAmount =
    ADDCOLUMNS ( vTableAccountMaxDate, "@Amount", [855_CP_QTD] )
VAR vTableFilter =
    FILTER ( vTableAmount, [@Amount] < Parameter[Parameter Value] )
VAR vResult =
    CALCULATE ( [855_CP_QTD], vTableFilter )
RETURN
    vResult

 

DataInsights_0-1661703123217.png

 

DataInsights_1-1661703141200.png

 

I'm not sure regarding the question about making the constant line reflect the value defined in Current Quarter CP % Filter.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@DataInsights You are amazing! I learned a lot more about Power BI through your DAX code.

The only issue left is the line chart and the area chart. They are still not reflected the Current Quarter CP % Filter. I want them to only show data from retailers whose most current Quarter-To-Date 855 CP are less than the Current Quarter CP % Filter.

mhsieh_1-1661790519336.png

Learning from your DAX code above for the cards, I was trying to write similar measure to make the line chart work, but I didn't succeed (see below code for my attempt). Hoping you could give me some more guidance! Thank you!

 

 

 

855_cp_test = 
VAR vTableAccountMaxDate =
    ADDCOLUMNS (
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_ID] ),
        "@MaxDate", CALCULATE ( MAX ( Retailer_Compliance[Start of Month] ) )
    )
VAR vTableAmount =
    ADDCOLUMNS ( vTableAccountMaxDate, "@Amount", [855_CP_QTD] )
VAR vTableFilter =
    FILTER ( vTableAmount, [@Amount] < Parameter[Parameter Value] )
VAR vAccountList = 
    SELECTCOLUMNS(
        vTableFilter,
        "ACCOUNT_ID", Retailer_Connections_Lookup[ACCOUNT_ID]
    )
VAR vAccountListDate =
    CROSSJOIN(
        vAccountList,
        VALUES('Calendar Lookup'[Start of Month])
    )
VAR vResult =
    CALCULATE ( [855_CP], vAccountListDate)
RETURN
    vResult

 

 

 

Here is the a pbix file using the sample data (Drive).

@mhsieh,

 

Glad to hear that! I believe you can use the same pattern, changing only the measure being calculated in vResult. Notice that everything else is the same--the filter logic is identical, and once you have the filter result in vTableFilter, you calculate [855_CP] in the context of vTableFilter. You can calculate any measure in the context of vTableFilter.

 

855_CP with Parameter = 
VAR vTableAccountMaxDate =
    ADDCOLUMNS (
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_ID] ),
        "@MaxDate", CALCULATE ( MAX ( Retailer_Compliance[Start of Month] ) )
    )
VAR vTableAmount =
    ADDCOLUMNS ( vTableAccountMaxDate, "@Amount", [855_CP_QTD] )
VAR vTableFilter =
    FILTER ( vTableAmount, [@Amount] < Parameter[Parameter Value] )
VAR vResult =
    CALCULATE ( [855_CP], vTableFilter )
RETURN
    vResult

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.