Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
CMccown
Helper I
Helper I

Calculate Season for Different Categories

I have data that has different seasons dependent upon category (see tables) and need a way to calculate these differences. I have a standard date table and a separate table that contains a column for two different rate types. Any help would be greatly appreciated!

Residential:

MonthSeason

January

Winter

FebruaryWinter
MarchWinter
AprilWinter
MayWinter
JuneSummer
JulySummer
AugustSummer
SeptemberSummer
OctoberWinter
NovemberWinter
DecemberWinter

 

Commercial

MonthSeason

January

Winter

FebruaryWinter
MarchWinter
AprilWinter
MaySummer
JuneSummer
JulySummer
AugustSummer
SeptemberSummer
OctoberSummer
NovemberWinter
DecemberWinter

 

 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @CMccown ,

According to your description, I create a sample to reproduce your problem.

There're four tables in the sample. Residential and Commercial tables are the same with yours. Here's the other two tables:

Cost table:

vkalyjmsft_0-1666854408120.png

Cost table show the cost one day in different season.

Date table:

vkalyjmsft_2-1666854466205.png

Suppose you want to calculate the cost of all days in each month per different category. Calculate two measures.

CommercialCost =
SUMX (
    FILTER ( 'Date', 'Date'[Month] = MAX ( 'Commercial'[Month] ) ),
    COUNTROWS ( 'Date' )
        * MAXX (
            FILTER ( 'Cost', 'Cost'[Season] = MAX ( 'Commercial'[Season] ) ),
            'Cost'[Cost]
        )
)
ResidentialCost =
SUMX (
    FILTER ( 'Date', 'Date'[Month] = MAX ( 'Residential'[Month] ) ),
    COUNTROWS ( 'Date' )
        * MAXX (
            FILTER ( 'Cost', 'Cost'[Season] = MAX ( 'Residential'[Season] ) ),
            'Cost'[Cost]
        )
)

Result:

Residential:

vkalyjmsft_3-1666854831098.png

Commercial:

vkalyjmsft_4-1666854840035.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

1 REPLY 1
v-yanjiang-msft
Community Support
Community Support

Hi @CMccown ,

According to your description, I create a sample to reproduce your problem.

There're four tables in the sample. Residential and Commercial tables are the same with yours. Here's the other two tables:

Cost table:

vkalyjmsft_0-1666854408120.png

Cost table show the cost one day in different season.

Date table:

vkalyjmsft_2-1666854466205.png

Suppose you want to calculate the cost of all days in each month per different category. Calculate two measures.

CommercialCost =
SUMX (
    FILTER ( 'Date', 'Date'[Month] = MAX ( 'Commercial'[Month] ) ),
    COUNTROWS ( 'Date' )
        * MAXX (
            FILTER ( 'Cost', 'Cost'[Season] = MAX ( 'Commercial'[Season] ) ),
            'Cost'[Cost]
        )
)
ResidentialCost =
SUMX (
    FILTER ( 'Date', 'Date'[Month] = MAX ( 'Residential'[Month] ) ),
    COUNTROWS ( 'Date' )
        * MAXX (
            FILTER ( 'Cost', 'Cost'[Season] = MAX ( 'Residential'[Season] ) ),
            'Cost'[Cost]
        )
)

Result:

Residential:

vkalyjmsft_3-1666854831098.png

Commercial:

vkalyjmsft_4-1666854840035.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.