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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
daniel_baciu
Helper I
Helper I

Measure doesn't filter things accordingly using a parameter

Hi,

 

Could you please help me fix the "Value 6" measure formula to only show data as in "Value 4" column? Data should be visible only up to P04 (which is the parameter i want to set up automatically).

 

2023-03-14 16_55_39-Sales Co Dashboards_4_Run Rate Chart_demo - Power BI Desktop.png

I tried several ways of getting the parameter input automatically, but it doesn't take it at all, except if i input the parameter manually. 

 

Both formulas are the same, just that "Value 4" measure has a manual input parameter (number "4"), while the parameter used in the "Value 6" column formula is built using a measure (created with SELECTEDVALUE formula).

 

"Value 4" column DAX formula is:

Value 4 = 
var CP = 4
return
if(
    max('data orders & sales demo'[numeric period]) <= CP && max('Dim Calendar'[Fiscal Year]) = 2023,
        CALCULATE (
            [Value k$],
            DATESINPERIOD('Dim Calendar'[Date], LASTDATE(DATEADD('Dim Calendar'[Date], 0, MONTH)), -12, MONTH),
                ( 'Data Orders & Sales Demo'[Scenario] = "ActualsFixed"   && 'Data Orders & Sales Demo'[Year] = "2023")    ||
                ( 'Data Orders & Sales Demo'[Scenario] = "PORFixed"      && 'Data Orders & Sales Demo'[Year] <> "2023")
        ),
    BLANK()
    )

 "Value 6" column DAX formula is:

Value 6 = 
var CP = [Current Period]
return
if(
    max('data orders & sales demo'[numeric period]) <= CP && max('Dim Calendar'[Fiscal Year]) = 2023,
        CALCULATE (
            [Value k$],
            DATESINPERIOD('Dim Calendar'[Date], LASTDATE(DATEADD('Dim Calendar'[Date], 0, MONTH)), -12, MONTH),
                ( 'Data Orders & Sales Demo'[Scenario] = "ActualsFixed"   && 'Data Orders & Sales Demo'[Year] = "2023")    ||
                ( 'Data Orders & Sales Demo'[Scenario] = "PORFixed"      && 'Data Orders & Sales Demo'[Year] <> "2023")
        ),
    BLANK()
    )

where [Current Period] is:

Current Period = SELECTEDVALUE('Data Orders & Sales Demo'[Numeric Period])

 

I have a Calendar table ('Dim Calendar") and Orders and Sales data table ("Data Orders & Sales Demo") which are joined using a bridge:

2023-03-14 16_55_09-Sales Co Dashboards_4_Run Rate Chart_demo - Power BI Desktop.png

Here is the pbix: https://drive.google.com/file/d/1exD3cvlZ5RiafUXoWaFzECPkHn1DsH4H/view?usp=sharing

 

Other workaround is welcomed as well - the aim is to get the data up to a period selected in a slicer in another page of the report, using below calculation:

 

 CALCULATE (
            [Value k$],
            DATESINPERIOD('Dim Calendar'[Date], LASTDATE(DATEADD('Dim Calendar'[Date], 0, MONTH)), -12, MONTH),
                ( 'Data Orders & Sales Demo'[Scenario] = "ActualsFixed"   && 'Data Orders & Sales Demo'[Year] = "2023")    ||
                ( 'Data Orders & Sales Demo'[Scenario] = "PORFixed"      && 'Data Orders & Sales Demo'[Year] <> "2023")
        ),

 

 

Thanks in advance!

4 REPLIES 4
olgad
Super User
Super User

Hi, if you drop the current period measure on your table you will see no 4 but the respective period, 1,2,3 because for every row the selected period is the one of the context of the row. You need to create a parameter not sitting in your calendar table, so the context doesnt interfere anymore.

olgad_0-1678812145363.pngolgad_1-1678812158712.png

Adjust your Value 6 

SELECTEDVALUE(Period[Period]) (My parameter is called Period)

DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Thank you for your reply.

I assume this is implying manually selecting the parameter every time i need to see another period.

What if I want this to change automatically whenever the period is changed in the index page? 

Daniel, so, one question, when zou select on index page p4 does it filter other visuals for p4 only or like with this measure upto p4? the slicer you can put on all the pages, hide it in the selection pane and  you can syncronize for those slicers for all the pages.


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Hi Olga,

 

yes, that slicer is filtering other visuals in the project; but I don't want that slicer to filter the page where i will use those measures (ie Run Rate). That's because i'll use it in a chart where i need to see all periods.

The ultimate goal is to automatically update the line chart (to be found in tab Run Rate) every time the period is changed in tab index. Meaning the dark blue is switching to a previous or a future period, as selected in the Period slicer in tab index...

 

2023-03-15 12_05_21-Sales Co Dashboards_4_Run Rate Chart_demo - Power BI Desktop.png
"Value 6" column is an extract of the formula in that line chart (you can check "Value RR 12 Mths k$ Actuals 3" measure which is included in the line chart).

 

Correct, that's how i proceeded with the slicer to have it syncronize all the other visuals, but not this one, as i need to see all the periods (for the POR line) but only the past periods (for Actuals)...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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