Forum Discussion

iW1DOV's avatar
iW1DOV
Icon for Helper II rankHelper II
1 year ago
Solved

How to filter for all or single value?

This is my requirement: I have a sales volumes table; there is a row for each sale a store made, for each day of the year.  Each row is marked with a flag Comparable - 1 means "Comparable", 0 means ...
  • DataInsights's avatar
    1 year ago

    iW1DOV,

     

    One approach is to use a field parameter. First create the two measures below, and then create a field parameter using these measures.

     

    All = SUM ( Sales[Amount] )
    Comparable only = CALCULATE ( [All], Sales[Comparable] = 1 )

     

    Field parameter (created via the user interface as explained in the article below):

     

    Parameter = {
        ("All", NAMEOF('Measure'[All]), 0),
        ("Comparable only", NAMEOF('Measure'[Comparable only]), 1)
    }

     

    Use 'Parameter'[Parameter] in a visual:

     

     

    -----

     

     

    https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters