cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
thisguy
Advocate I
Advocate I

SELECTEDVALUE alternate result not passing to filter - is there a way to do this?

I posted this previously but i don't think i was able to explain my problem correctly - I would like the signups vs target visual to show the latest month if nothing is selected in the signups by month visual - it currently shows the full history if nothing is selected.  

 

PBIX with sample data: 

https://drive.google.com/file/d/1khDD9vZDYgV14BDx-Ti1nJiStQGsrmGM/view?usp=sharing

 

if you select a month in the first visual the second visual filters correctly - if nothing is selected the second visual should show May (as per the selected month card) but it shows all months.  

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below measures and the attached pbix file.

 

SelectedMTD cumulative = 
VAR _maxdate =
    CALCULATE ( MAX ( Volumes[original_received_date] ), REMOVEFILTERS () )
VAR _maxmonthyear =
    MAXX (
        FILTER ( ALL ( DIM_Calendar ), DIM_Calendar[Date] = _maxdate ),
        DIM_Calendar[MonthYear]
    )
VAR _mtdmeasure =
    CALCULATE ( SUM ( Volumes[count per day] ), DATESMTD ( DIM_Calendar[Date] ) )
VAR SignUpsMTD =
    SWITCH (
        TRUE (),
        CALCULATE ( COUNTROWS ( VALUES ( DIM_Calendar[MonthYear] ) ), ALLSELECTED () ) = 1, _mtdmeasure,
        CALCULATE (
            SUM ( Volumes[count per day] ),
            DATESMTD ( DIM_Calendar[Date] ),
            DIM_Calendar[MonthYear] = _maxmonthyear
        )
    )
RETURN
    SignUpsMTD

 

Target MTD = 
VAR _maxdate =
    CALCULATE ( MAX ( Volumes[original_received_date] ), REMOVEFILTERS () )
VAR _maxmonthyear =
    MAXX (
        FILTER ( ALL ( DIM_Calendar ), DIM_Calendar[Date] = _maxdate ),
        DIM_Calendar[MonthYear]
    )
VAR _mtdmeasure =
    CALCULATE ( SUM ( Targets[Target] ), DATESMTD ( DIM_Calendar[Date] ) )
VAR SignUpsMTD =
    SWITCH (
        TRUE (),
        CALCULATE ( COUNTROWS ( VALUES ( DIM_Calendar[MonthYear] ) ), ALLSELECTED () ) = 1, _mtdmeasure,
        CALCULATE (
            SUM ( Targets[Target] ),
            DATESMTD ( DIM_Calendar[Date] ),
            DIM_Calendar[MonthYear] = _maxmonthyear
        )
    )
RETURN
    SignUpsMTD

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @thisguy 
Here is another way of doing that similar to yours

https://www.dropbox.com/t/OUOkIshFtRXkSqKf

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below measures and the attached pbix file.

 

SelectedMTD cumulative = 
VAR _maxdate =
    CALCULATE ( MAX ( Volumes[original_received_date] ), REMOVEFILTERS () )
VAR _maxmonthyear =
    MAXX (
        FILTER ( ALL ( DIM_Calendar ), DIM_Calendar[Date] = _maxdate ),
        DIM_Calendar[MonthYear]
    )
VAR _mtdmeasure =
    CALCULATE ( SUM ( Volumes[count per day] ), DATESMTD ( DIM_Calendar[Date] ) )
VAR SignUpsMTD =
    SWITCH (
        TRUE (),
        CALCULATE ( COUNTROWS ( VALUES ( DIM_Calendar[MonthYear] ) ), ALLSELECTED () ) = 1, _mtdmeasure,
        CALCULATE (
            SUM ( Volumes[count per day] ),
            DATESMTD ( DIM_Calendar[Date] ),
            DIM_Calendar[MonthYear] = _maxmonthyear
        )
    )
RETURN
    SignUpsMTD

 

Target MTD = 
VAR _maxdate =
    CALCULATE ( MAX ( Volumes[original_received_date] ), REMOVEFILTERS () )
VAR _maxmonthyear =
    MAXX (
        FILTER ( ALL ( DIM_Calendar ), DIM_Calendar[Date] = _maxdate ),
        DIM_Calendar[MonthYear]
    )
VAR _mtdmeasure =
    CALCULATE ( SUM ( Targets[Target] ), DATESMTD ( DIM_Calendar[Date] ) )
VAR SignUpsMTD =
    SWITCH (
        TRUE (),
        CALCULATE ( COUNTROWS ( VALUES ( DIM_Calendar[MonthYear] ) ), ALLSELECTED () ) = 1, _mtdmeasure,
        CALCULATE (
            SUM ( Targets[Target] ),
            DATESMTD ( DIM_Calendar[Date] ),
            DIM_Calendar[MonthYear] = _maxmonthyear
        )
    )
RETURN
    SignUpsMTD

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


That works perfectly, thankyou so much 🙂

 

I thought i was close to working it out, but this is very different to my attempt  😕

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors