Forum Discussion

vividarinda's avatar
vividarinda
Icon for Helper II rankHelper II
2 years ago
Solved

How to get max min with condition another table

Hi All,

I have the data like this :

table historical ->

 

 

table logic ->

 

 

the current visualization  like this :

 

but expected result like this :

 

 

i want to show the visualization historical based on table logic.

this link for power bi : visualization 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi vividarinda ,

     

    Thanks Anonymous  for the quick reply. I have some other thoughts to add:

    1.We can create two measures.

    _blowbypress_max =
    CALCULATE (
        MAX ( 'raw data'[blowbypress_max] ),
        FILTER (
            ALLSELECTED ( 'raw data' ),
            'raw data'[unitno] = MAX ( 'raw data'[unitno] )
                && 'raw data'[blowbypress_max_flag] = 1
        )
    )
    
    _boost_press_max =
    CALCULATE (
        MIN ( 'raw data'[boost_press_max] ),
        FILTER (
            ALLSELECTED ( 'raw data' ),
            'raw data'[unitno] = MAX ( 'raw data'[unitno] )
                && 'raw data'[boost_press_max_flag] = 1
        )
    )
    

    2.Then the result is as follows.

    Best Regards,

    Neeko Tang

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    You can do this with a measure.  You'll need 1 measure for blowbypress_max and another for boost_press_max.

    The basic structure of your measure would be:

    Blow by Press Max = var UnitNo = SELECTEDVALUE('YourTable'[UnitNo])
    RETURN
    SWITCH(
    	UnitNo,
    	"PC2000", <Some Code Here>,
    	"HD785", <Some Code Here>,
    	"D375A", <Some Code Here>,	
    	BLANK()
    )

     

    just replace the "Some Code Here" with the dax code that would do what you need and how it differs between units.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi vividarinda ,

     

    Thanks Anonymous  for the quick reply. I have some other thoughts to add:

    1.We can create two measures.

    _blowbypress_max =
    CALCULATE (
        MAX ( 'raw data'[blowbypress_max] ),
        FILTER (
            ALLSELECTED ( 'raw data' ),
            'raw data'[unitno] = MAX ( 'raw data'[unitno] )
                && 'raw data'[blowbypress_max_flag] = 1
        )
    )
    
    _boost_press_max =
    CALCULATE (
        MIN ( 'raw data'[boost_press_max] ),
        FILTER (
            ALLSELECTED ( 'raw data' ),
            'raw data'[unitno] = MAX ( 'raw data'[unitno] )
                && 'raw data'[boost_press_max_flag] = 1
        )
    )
    

    2.Then the result is as follows.

    Best Regards,

    Neeko Tang

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