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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
abhijit_vetal
Frequent Visitor

Extract specific rows from table based on dynamic slicer selection

I have 3 columns Activity period, fiscal period and gross_profit having monthly data .I have activity period on slicer. Now I want to show gross profit of next two fiscal period months. I am not getting how can I approach it I have tried using dateadd function but not getting expected result also tried using calculate function I am still not getting what is expected, please help me I am new to Power BI community

(note-Gross profit is a measure)

On selecting slicer (Activity period= may 2021)

input:

Activity periodFiscal periodGross profit
may 2021april 2021333
may 2021may 20214303
may 2021june 20213340
may 2021july 2021-1112
may 2021august  2021230

 

output:

Activity periodFiscal period Gross profit
may 2021april 2021 
may 2021may 2021 
may 2021june 2021 3340
may 2021 july 2021-1112
may 2021august  2021 

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @abhijit_vetal 

You can try the following steps:

1.create a saperate calculated table

 

Slicer = DISTINCT('Table'[Fiscal period]) 

 

2.add a new measure to replace the value of measure[M_Gross profit]

 

M_result = 
IF (
    DATEDIFF (
        MAX ( Slicer[Fiscal period] ),
        MAX ( 'Table'[Fiscal period] ),
        MONTH
    )
        IN { 1, 2 },
    [M_Gross profit],
    BLANK ()
)

 

170.png

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @abhijit_vetal 

You can try the following steps:

1.create a saperate calculated table

 

Slicer = DISTINCT('Table'[Fiscal period]) 

 

2.add a new measure to replace the value of measure[M_Gross profit]

 

M_result = 
IF (
    DATEDIFF (
        MAX ( Slicer[Fiscal period] ),
        MAX ( 'Table'[Fiscal period] ),
        MONTH
    )
        IN { 1, 2 },
    [M_Gross profit],
    BLANK ()
)

 

170.png

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank you so much for Solving my problem Really apreciated. Keep doing great work for community

abhijit_vetal
Frequent Visitor

@amitchandak @AlexisOlson @TheoC  can you help please

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.