+ Reply to Thread
Results 1 to 9 of 9

Get members and values based on rank from Datamodel

  1. #1
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    156

    Get members and values based on rank from Datamodel

    Hi

    In short, I do have a datamodel, I need to get the TOP 1 member of one measure and populate the name and values of one dimension (reasons)
    I need to do this 2 times, one time for Downtime, one time for scrap

    Background:
    3 Value tables
    1 Downtime table, 1 Scrap table, 1 Index table, each with date, machine and articel

    3 Dimension table
    1 Date, 1 machine, 1 articel

    All of them are connected in the datamodel area

    Now I do want to create a dynamic dashboard where I can choose a month (or period) and then see the following
    Top 3 for one measure of all machines (Measure Avg Index in the Index table)
    For the Top 1 of the period i want to get a chart for the downtime reasons
    Same for Top 2

    I can do this with pivot charts but if the month change and also the top 3, i need to manually change and select the machines to catch the top 1

    So it is not really dynamic. I think this should work with the cube formulas?

    I can use the Top3 Pivottable as basis, then take the number 1 and create a Preparation table for my chart. This preparation table is showing the measure Downtime(h) and populate the reasons for the selection (Month and Machine) and their values. This can be then used to create my chart.


    I prepared an example table, the sheet with the pivot table is basically my results, just manual choose every time I choose a different period.

    I am able to use the cubevalue formuals already, for other cube formula I am not yet fit.

    Every help is appreciated

    thanks
    Attached Files Attached Files
    Last edited by hansolu; 09-13-2021 at 01:11 AM. Reason: solved

  2. #2
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    156

    Re: Get members and values based on rank from Datamodel

    Hi

    I was trying a bit more and found something which is working.

    What I do not understand

    Difference between members and children in the cubeset formula
    Please Login or Register  to view this content.
    I also had troubles to define my cubeset
    Please Login or Register  to view this content.
    The set_expression with filter for the machine and date and then give me the members for the reasons was difficult to find out for me
    Another thing for the cubeset formula, I am not able to add the filter for nonempty(...). I still see always all values

    One problem with the charts was the refreshing when I change the slicer. I changed the offset formula to ensure I always have an offset of min. 1, then the refresh work

    Any ideas from someone to improve my approach?

    Thanks
    Attached Files Attached Files

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Get members and values based on rank from Datamodel

    Hi,

    I haven't looked at your CUBE formula approach yet, but I would do it in Power Pivot, viz:

    Create a new Measure:

    Top Avg Index :=
    VAR MyTable =
    SUMMARIZE ( Index, Index[Machine], "Average Index", AVERAGE ( Index[Index] ) )
    RETURN
    MAXX ( MyTable, [Average Index] )


    Then filter your PvtTop1, used to generate the chart, via Value Filters/Top 10 and 'Top 1 Item by Top Avg Index'.

    Edit: this isn't in fact necessary, you could simply apply the same filter as above but using your Avg Index measure, rather than my Top Avg Index one.

    Regards
    Last edited by XOR LX; 09-04-2021 at 08:36 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    156

    Re: Get members and values based on rank from Datamodel

    Hi

    I tried the filter Topx, did not know I can filter by a measure which is not in the table itself. Was helpfull, thanks
    In the PvtTop1 I can now show the top3 of the selected month or period. As I do want to create a chart sorted by the reasons for each Top1 to Top3, I thought to add a rank to the index, then use 3 pvt tables and make the chart.
    My formula is
    Please Login or Register  to view this content.
    but I do get wrong results of the Rank, always a 1.

    Any ideas why the rankx formula only spill out 1
    I guess for my final dashboard I most likley need to combine the pivot table and some cube formulas.


    For my cubeformulas I do have two big issues.

    1. Nonempty values in the cubeset
    Please Login or Register  to view this content.
    I still get reasons in the ranked member although the measure do not have values
    ranked member cubevalue
    Idea wrong 17.5
    High Power 13.9
    No Material 3.6
    (blank)
    No Man

    2. Combining slicers in cubeset
    I am able to combine multiple slicers with this approach.
    First get the first value of the slicer
    D6:
    Please Login or Register  to view this content.
    Then in the cubeset I just link to this cell but need to define all the way down ([Dim_Date].[Month].["&$D$6&"],)
    Please Login or Register  to view this content.
    Is there a way to attack these 2 issues?


    thanks
    Last edited by hansolu; 09-05-2021 at 04:53 AM.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Get members and values based on rank from Datamodel

    Hi,

    As far as I was aware, my previous post had solved your original requirement. If you have new requirements, perhaps you could re-upload your workbook with the expected results clearly outlined?

    Regards

  6. #6
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    156

    Re: Get members and values based on rank from Datamodel

    Hi

    Nearly finished. Let me summarize.
    Option 1 Pivot tables.
    Issue is I want to show the reason for the bottom 3 machines, each machine one seperate chart. For bottom one no issue, but for second and third worst, I dont get it done. I thougt to make a rank measure, and then filter Rank 1, 2 and 3 to show only the ranked machine but I have issues to make the rank.


    Option 2 with cube formulas

    In S10 i create a cubeset for the bottom 4 machines. That is working, but I see the non empty as rank 1(lowest one). How can i use the NONEMPTY function in the cubeset?
    HTML Code: 
    Second issue with the cubeset is the slicers. I am able to manage one selection of the slicer correctly, as soon as i have multiple selections, I receive the wrong results.

    I updated the file and uploaded again.

    thanks
    Attached Files Attached Files

  7. #7
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Get members and values based on rank from Datamodel

    First, you have a blank row at the end of your DownTime table which I suggest you remove.

    Second, your rank measure should be:

    RankIndex:=RANKX(ALL(Dim_MachineList),[Avg Index],,ASC)

    After which you can filter your pivots by setting this value as desired, e.g. to 1, 2, etc.

    Regards

  8. #8
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    156

    Re: Get members and values based on rank from Datamodel

    Hi
    thanks, I had a look and its working for the data provided if i delete the empty row. Issue is, in my real data I do have sometimes an AVG Index which is empty.

    So I modified the formula a bit.

    Please Login or Register  to view this content.
    This skip the empty rows, but then start the counting not with 1 (as 1 is used for the empty i guess). Another issue is, on my real data I do have a machine group (added it in the excample here)
    If I only group to 1 or 2 elements, the ranking is working perfect (except the issue with start counting at 2 sometimes if there is an empty row)

    INDEX Ranktest
    91.1% 18
    90.4% 17
    88.9% 16
    86.5% 15
    86.0% 14
    ...

    If I group ALL in the pivot filter, i Get the ranking below. I use the same measure, same pivot table, just group to all members. Machines are unique, so only member of one group
    INDEX Ranktest
    86.0% 1
    144.1% 1
    89.8% 1
    77.1% 1
    86.4% 1
    52.8% 1
    88.7% 1

    Any ideas how to address this issue?

    thanks
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    156

    Re: Get members and values based on rank from Datamodel

    Hi
    short update for the cubeformulas and slicer:

    1. Nonempty values in the cubeset: I do a temporary step, copy the data range, use a filter array formula and sort. Maybe a bit too much but works fine to get a list of cubemembers with value only.
    2. Multiple Slicers: I did some research, seems thats not possible. It is not perfect but I just give a warning is more then one value of one slicer is selected, thats fine

    3. Rankx: As this is basically not linked to the original question, I will create a sample file and create a new Thread for this topic

    thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Rank based on values in 2 colums
    By sachin99 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-19-2021, 01:18 AM
  2. [SOLVED] How To Rank based on values in another cell
    By Don Adeks in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-11-2017, 01:51 AM
  3. Replies: 4
    Last Post: 07-13-2017, 05:45 PM
  4. How to rank values based on conditions?
    By joash_9292 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-09-2017, 05:25 PM
  5. Rank If based on values in another range
    By lucasreece in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-27-2015, 09:41 AM
  6. [SOLVED] Rank values based on criteria.
    By Kompicek in forum Excel General
    Replies: 5
    Last Post: 12-12-2013, 02:36 AM
  7. Displaying values based on rank
    By ryantaylor in forum Excel General
    Replies: 1
    Last Post: 01-11-2011, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1