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
UsePowerBI
Post Prodigy
Post Prodigy

Measure of respective bins

Hello

 

I have this data:

 

ProdMetricTimestampValueConcatTimestamp (bins)
AMetric Basis27/11/2021 00:004A - Metric Basis27/11/2021
AMetric 127/11/2021 00:301A - Metric 127/11/2021
AMetric 127/11/2021 00:312A - Metric 127/11/2021
AMetric 127/11/2021 00:329A - Metric 127/11/2021
AMetric 127/11/2021 00:3310A - Metric 127/11/2021
BMetric Basis27/11/2021 00:008B - Metric Basis27/11/2021
BMetric 127/11/2021 00:305B - Metric 127/11/2021
BMetric 127/11/2021 00:316B - Metric 127/11/2021
BMetric 127/11/2021 00:3213B - Metric 127/11/2021
BMetric 127/11/2021 00:3314B - Metric 127/11/2021

 

I want to create a line graph per 'Timestamp' with a Slicer using 'Concat' and I want in the Y axis to show:

'Value' of the selected 'Concat' of the respective 'Timestamp' divided by 'Value' of the 'Metric Basis' of same 'Prod' (from the selected 'Concat') of the respective 'Timestamp (bins)'

 

So for example, if I choose in the slicer = 'B - Metric 1', the X,Y axes would be:

27/11/2021 00:30, 5/8
27/11/2021 00:31, 6/8
27/11/2021 00:32, 13/8
27/11/2021 00:33, 14/8

 

Any idea how the Measure should be?

 

Thanks!

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @UsePowerBI 

 

You can try the following methods.

Measure = 
VAR n1 =
    SELECTEDVALUE ( 'Table'[Value] )
VAR n2 =
    CALCULATE (
        MAX ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            [Metric] = "Metric Basis"
                && [Prod] = MAX ( 'Table'[Prod] )
        )
    )
RETURN
    DIVIDE ( n1, n2 )

vzhangti_0-1640576661675.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @UsePowerBI 

 

You can try the following methods.

Measure = 
VAR n1 =
    SELECTEDVALUE ( 'Table'[Value] )
VAR n2 =
    CALCULATE (
        MAX ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            [Metric] = "Metric Basis"
                && [Prod] = MAX ( 'Table'[Prod] )
        )
    )
RETURN
    DIVIDE ( n1, n2 )

vzhangti_0-1640576661675.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bcdobbs
Super User
Super User

I think this should work:

 

 

PlotValue = 

VAR CurrentValue = SELECTEDVALUE( MainTable[Value] )

VAR BasisValue =
    CALCULATE (
        SELECTEDVALUE ( MainTable[Value] ),
        REMOVEFILTERS ( MainTable ),
        VALUES ( MainTable[Prod] ),
        VALUES ( MainTable[Timetamp (bins)] ),
        MainTable[Metric] = "Metric Basis" 
    )

RETURN
    DIVIDE ( CurrentValue, BasisValue )

 

 

The key logic is in the CALCULATE for BasisValue. It removes all filters from your table (I called it MainTable). Then puts back any existing filters on the Prod and Timetamp (bins) columns. Finally it adds a filter to only get "Metric Basis".

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

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.