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
SwathiGanesh
Frequent Visitor

Help me find rankx by latest date after finding the minimum of date for each category

Question: I am trying to analyzr video game dataset, analyzing data from the 'Table1 ’ table. This table contains information about various video games, including their hitrate, game type, winrate, release date, and other details. Some game names may be repeated in the table. i want to create a combined DAX measure named ‘CombinedDAX’ that calculates the rank of the most recent games where the ‘MinDateFlag’ is 1.
e.

Additionally, MinDateFlag represents a flag indicating the minimum release date for each game, even if the game name is repeated in the table. It is calculated
based on the release date of each game. If the release date of a game matches the minimum release date for that game, the MinDateFlag is set to 1; otherwise, it is set to 0.

I tried this its not working please help, attached a sample file

  • CombinedDAX =
    VAR MinDateFlag =
    IF(
    ‘Dim Game’[Release Date] = CALCULATE(MIN(‘Dim Game’[Release Date]), ALLEXCEPT(‘Dim Game’, ‘Dim Game’[Game Name])),
    1,
    0
    )
    VAR RecentGamesRank =
    IF(
    MinDateFlag = 1,
    RANKX(
    FILTER(‘Dim Game’, MinDateFlag = 1),
    ‘Dim Game’[Release Date],
    ,
    DESC,
    Dense
    ),
    BLANK()
    )
    RETURN
    RecentGamesRank
2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but please try something like below whether it suits your requirement.

 

CombinedDAX =
VAR _currentgamename = 'Dim Game'[Game Name]
VAR _mindate =
    MINX (
        FILTER ( 'Dim Game', 'Dim Game'[Game Name] = _currentgamename ),
        'Dim Game'[Release Date]
    )
VAR RecentGamesRank =
    IF (
        'Dim Game'[Release Date] = _mindate,
        RANKX (
            FILTER ( 'Dim Game', 'Dim Game'[Release Date] = _mindate ),
            'Dim Game'[Release Date],
            ,
            DESC,
            DENSE
        ),
        BLANK ()
    )
RETURN
    RecentGamesRank

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


Thank you for responding, but unfortunately, the solution provided isn't producing the expected results. It's returning either 1 or blank values. In my original approach, although I had ranks, they weren't continuous.

Here's how my table looks:

 

Game Name  TurnoverGame TypePayoutGameLaunchDateMinDateFlagRecentGamesRankCombinedDAX
Call of Duty: Warzone$500,000Battle Royale$250,000March 10, 2020111
Call of Duty: Warzone$600,000Battle Royale$300,000April 15, 20210nullnull
Among Us$200,000Social deduction$100,000June 15, 2018122
Fort1$1,000,000Battle Royale$500,000July 25, 2017133
Fort$1,200,000Battle Royale$600,000August 30, 20180nullnull
Minecraft$800,000Sandbox$400,000November 18, 2011144
Minecraft$900,000Sandbox$450,000December 21, 20120nullnull
League of Legends$1,500,000MOBA$750,000October 27, 2009155
League of Legends$2,000,000MOBA$1,000,000November 20, 20100nullnull
PUBG$700,000Battle Royale$350,000December 20, 2017166
PUBG$750,000Battle Royale$375,000January 25, 20190nullnull
Among Us$300,000Social deduction$150,000July 15, 20200nullnull
Minecraft$1,000,000Sandbox$500,000May 10, 2021177
Minecraft$1,200,000Sandbox$600,000June 30, 20220null 

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.