The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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:
Month | Season |
January | Winter |
February | Winter |
March | Winter |
April | Winter |
May | Winter |
June | Summer |
July | Summer |
August | Summer |
September | Summer |
October | Winter |
November | Winter |
December | Winter |
Commercial
Month | Season |
January | Winter |
February | Winter |
March | Winter |
April | Winter |
May | Summer |
June | Summer |
July | Summer |
August | Summer |
September | Summer |
October | Summer |
November | Winter |
December | Winter |
Solved! Go to Solution.
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:
Cost table show the cost one day in different season.
Date table:
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:
Commercial:
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.
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:
Cost table show the cost one day in different season.
Date table:
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:
Commercial:
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
80 | |
80 | |
48 | |
40 |
User | Count |
---|---|
150 | |
110 | |
64 | |
64 | |
57 |