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

Use the current Quarter-To-Date's value (a measure) and make it a slicer.

Hi guys, I will try my best to describe what I want to achieve. But let me know what other info I need to provide so that I can be better assisted!

I have this matrix showing all the accounts (here I only show 2 accounts - Academy Sports, camping World), over the months, their Document(850, 855) Exchange Volume. 

mhsieh_1-1660521717128.png

855 Complaince is just [855]/[850]
And 855_CP_QTD is the Quarter-To-Date Value of the 855 Compliance. Below is the measure calculation for both.

 

855 Compliance = 
IFERROR(
    [855] / [850],
    0
)
855_CP_QTD = 
IFERROR(
    [855_QTD] / [850_QTD],
    0
)

 

 

I would like to create a Compliance Slicer ranging from 0 ~ 1 (with 0.01 increments). If I select the range of the slicer to be 0 to 0.7, then in the matrix visual, only Camping World has the most recent 855_CP_QTD (0.65) fall into that range, so the matrix will only display Camping World's data.

 

How do I do that? 

Hopefully my question make sense. But let me know then I can try to explain again!

 

This is how the table relationships look like

mhsieh_0-1660522678747.png

 

 

Thank you!!

 

 

 

1 ACCEPTED SOLUTION

@mhsieh,

 

Try this measure:

 

Filter = 
VAR vMaxAccountDate =
    CALCULATE (
        MAX ( Retailer_Compliance[Start of Month] ),
        ALL ( Retailer_Compliance ),
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_NAME] )
    )
VAR vAmount =
    CALCULATE (
        [855_CP_QTD],
        Retailer_Compliance[Start of Month] = vMaxAccountDate
    )
VAR vResult =
    IF ( vAmount < Parameter[Parameter Value], 1 )
RETURN
    vResult

 

DataInsights_0-1660580254126.png

 





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

Proud to be a Super User!




View solution in original post

10 REPLIES 10
mhsieh
Helper II
Helper II

@DataInsights  I'm sorry to bother you again. As I continue to develop this dashboard. I have a couple more questions, hoping you could help me. Now my matrix is reflecting correctly to the filter, but other visuals are not.

 

Let me know if you think it's better for me to put up another post for this question.

 

mhsieh_3-1661438754969.png

 

 

mhsieh_2-1661438588271.png

Measures involved:

Number of Retailers - 

Num of Retailers = 
DISTINCTCOUNT(
    Retailer_Compliance[SALESFORCE_ACCOUNT_ID]
)

Line Chart - 

855_CP = 
IFERROR(
    [855] / [850],
    0
    )

Area Chart - 

850 = 
IF(
    ISBLANK(
        SUM(Retailer_Compliance[VOL_850])
    ),
    0,
    SUM(Retailer_Compliance[VOL_850]
    )
)
855 = 
IF(
    ISBLANK(
        SUM(Retailer_Compliance[VOL_855])
    ),
    0,
    SUM(Retailer_Compliance[VOL_855]
    )
)

 

Thank you!!

 

@mhsieh,

 

I think the issue is due to the visuals in red not having filter context for Retailer. The matrix has Retailer, so it slices correctly. However, the card (for example) doesn't have Retailer, so it aggregates multiple retailers. Can you share a link to your sanitized pbix, using one of the file services like OneDrive?

 

I recommend creating a new post (tag me once you create it and I'll take a look).





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

Proud to be a Super User!




DataInsights
Super User
Super User

@mhsieh,

 

You can achieve this with a Numeric Range parameter. See solution below:

 

https://community.powerbi.com/t5/Desktop/Global-Parameters-Variables-Table/m-p/2695256#M943218 





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

Proud to be a Super User!




Hi @DataInsights

This is very helpful!

Now I have my filter measure set like this:

Filter = 
IF(
    [855_CP_QTD] < Parameter[Parameter Value],
    1
)


 And it's giving me the below result.

mhsieh_0-1660575461976.png

How can I modify my filter measure to get:
If an account's most recent month's [855_CP_QTD] is less than 0.7 (slider), then the account's all data (the whole 1/1 - 7/1) will show.

@mhsieh,

 

Try this measure:

 

Filter = 
VAR vMaxAccountDate =
    CALCULATE (
        MAX ( Retailer_Compliance[Start of Month] ),
        ALL ( Retailer_Compliance ),
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_NAME] )
    )
VAR vAmount =
    CALCULATE (
        [855_CP_QTD],
        Retailer_Compliance[Start of Month] = vMaxAccountDate
    )
VAR vResult =
    IF ( vAmount < Parameter[Parameter Value], 1 )
RETURN
    vResult

 

DataInsights_0-1660580254126.png

 





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

Proud to be a Super User!




@DataInsights 

I changed the 'Retailer Compiance'[Start of Month] to 'Calendar Lookup'[Start of Month] in your provided code, and it works!! Thank you so much!

 

Filter = 
VAR vMaxAccountDate =
    CALCULATE (
        MAX ( 'Calendar Lookup'[Start of Month]),
        ALL ( 'Calendar Lookup' ),
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_NAME] )
    )
VAR vAmount =
    CALCULATE (
        [855_CP_QTD],
        'Calendar Lookup'[Start of Month] = vMaxAccountDate
    )
VAR vResult =
    IF ( vAmount < Parameter[Parameter Value], 1 )
RETURN
    vResult

 

mhsieh_0-1660582807217.png

 

One more question.
Now it's showing accounts that have their most recent [855_CP_QTD] < 0.7.

What if I want to change the slicer to become BETWEEN. Say between 0.5-0.7 and only show accounts whose most recent [855_CP_QTD] is between 0.5 to 0.7.

How would I do that?
 

@mhsieh,

 

Glad to hear that works. For BETWEEN logic, you can create two Numeric Range parameters (From and To). Adjust the IF statement as follows:

 

Filter =
VAR vMaxAccountDate =
    CALCULATE (
        MAX ( 'Calendar Lookup'[Start of Month] ),
        ALL ( 'Calendar Lookup' ),
        VALUES ( Retailer_Connections_Lookup[ACCOUNT_NAME] )
    )
VAR vAmount =
    CALCULATE ( [855_CP_QTD], 'Calendar Lookup'[Start of Month] = vMaxAccountDate )
VAR vResult =
    IF (
        vAmount >= ParameterFrom[Parameter Value]
            && vAmount <= ParameterTo[Parameter Value],
        1
    )
RETURN
    vResult

 





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

Proud to be a Super User!




@DataInsights 
You are saying that I will need to have 2 slicers?

@mhsieh,

 

Yes, one for ParameterFrom and one for ParameterTo.





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

Proud to be a Super User!




@DataInsights Got everything to work! Thank you again!

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.

Top Solution Authors