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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors