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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.