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

Column with the value of max appearances in day

Hello,

 

I need some help to create/add a column with the value that has the max no of appearances in a day.

I have a weather station and i need to put in a table the max wind direction, the table looks like:

 

ReadTimeAnemometerWindDirection
3/6/2019 23:194.8NE
3/6/2019 23:252.4SSE
3/6/2019 23:311.6SE
3/6/2019 23:372.4SSE
3/6/2019 23:422.4N
3/6/2019 23:483.2E
3/6/2019 23:533.2NE
3/6/2019 23:591.6SW
3/7/2019 0:052.4NE
3/7/2019 0:110.8N
3/7/2019 0:170NoWind
3/7/2019 0:220NoWind
3/7/2019 0:283.2SE
3/7/2019 0:333.2SE
3/7/2019 0:392.4SE
3/7/2019 0:451.6NE
3/7/2019 0:518E

 

I need a formula to make the table look like:

 

ReadTimeAnemometerWindDirectionMax WindDirection
3/6/2019 23:194.8NENE, SSE
3/6/2019 23:252.4SSENE, SSE
3/6/2019 23:311.6SENE, SSE
3/6/2019 23:372.4SSENE, SSE
3/6/2019 23:422.4NNE, SSE
3/6/2019 23:483.2ENE, SSE
3/6/2019 23:533.2NENE, SSE
3/6/2019 23:591.6SWNE, SSE
3/7/2019 0:052.4NESE
3/7/2019 0:110.8NSE
3/7/2019 0:170NoWindSE
3/7/2019 0:220NoWindSE
3/7/2019 0:283.2SESE
3/7/2019 0:333.2SESE
3/7/2019 0:392.4SESE
3/7/2019 0:451.6NESE
3/7/2019 0:518ESE

 

On 6 March 2019 i had the winddirection 2 times from NE and 2 time from SSE, so i need the both and on 7 March 2019 i had 3 times from SE.

The NoWind direction should not be considered.

 

Thank you.

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@IulianDuta 

 

Try this Calc column

 

Calc Column =
CONCATENATEX (
    TOPN (
        1,
        SUMMARIZE (
            FILTER ( Table1, [ReadTime].[Date] = EARLIER ( Table1[ReadTime].[Date] ) ),
            [ReadTime].[Date],
            Table1[WindDirection],
            "MyCount", COUNTROWS ( Table1 )
        ),
        [MyCount], DESC
    ),
    [WindDirection],
    ", "
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@IulianDuta 

 

Try this Calc column

 

Calc Column =
CONCATENATEX (
    TOPN (
        1,
        SUMMARIZE (
            FILTER ( Table1, [ReadTime].[Date] = EARLIER ( Table1[ReadTime].[Date] ) ),
            [ReadTime].[Date],
            Table1[WindDirection],
            "MyCount", COUNTROWS ( Table1 )
        ),
        [MyCount], DESC
    ),
    [WindDirection],
    ", "
)

Regards
Zubair

Please try my custom visuals

Hello@Zubair_Muhammad ,

 

The only missing thing was that the sintax took into consideration also the NoWind values.

So i added the "and" sintax in the filter command like this:

 

FILTER ( Table1, and ([ReadTime].[Date] = EARLIER ( Table1[ReadTime].[Date] ), Table1[WindDirection] <> "NoWind" )),

Now it is exactlly what i needed.

 

Thank you very much.

 

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.