Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Team,
I have 4 columns in my table.I need to calculate MIN/MAX Week of as per MIN/MAX value in particulator Dept . I need to calculate value of MIN week in particualr dept. I have to calculate four measure.
Measure1= MIN Week of Value (format:- Year-Week)
Measure2= MAX Week of Value (format:- Year-Week)
Measure3= MIN Week of min year(format:- Year-Week)
Measure4= Value of Measure3
For Example of Dept1 in table :-Min value is 43685 , I need to calculate week of this value is 10 (2022-2).Max value is 85601 , I need to calculate week of this value is 9 (2020-9). I need to calculate MIN Week is 4 as per year Min 2020 then i need to calculate value of this week is 69826.
Sample Data:-
Solved! Go to Solution.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create measures as below.
MaxValue =
CALCULATE(
MAX('Table'[Value]),
ALLEXCEPT('Table','Table'[Dept])
)
MaxValue Weeks =
CONCATENATEX(
FILTER(
'Table',
'Table'[Value]=[MaxValue]
),
[YearWeek],
","
)
MinValue =
CALCULATE(
MIN('Table'[Value]),
ALLEXCEPT('Table','Table'[Dept])
)
MinValue Weeks =
CONCATENATEX(
FILTER(
'Table',
'Table'[Value]=[MinValue]
),
[YearWeek],
","
)
MinWeek Value =
var minweek =
CALCULATE(
MIN('Table'[YearWeek]),
ALLEXCEPT('Table','Table'[Dept])
)
return
CALCULATE(
SUM('Table'[Value]),
FILTER(
ALLEXCEPT('Table','Table'[Dept]),
[YearWeek]=minweek
)
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create measures as below.
MaxValue =
CALCULATE(
MAX('Table'[Value]),
ALLEXCEPT('Table','Table'[Dept])
)
MaxValue Weeks =
CONCATENATEX(
FILTER(
'Table',
'Table'[Value]=[MaxValue]
),
[YearWeek],
","
)
MinValue =
CALCULATE(
MIN('Table'[Value]),
ALLEXCEPT('Table','Table'[Dept])
)
MinValue Weeks =
CONCATENATEX(
FILTER(
'Table',
'Table'[Value]=[MinValue]
),
[YearWeek],
","
)
MinWeek Value =
var minweek =
CALCULATE(
MIN('Table'[YearWeek]),
ALLEXCEPT('Table','Table'[Dept])
)
return
CALCULATE(
SUM('Table'[Value]),
FILTER(
ALLEXCEPT('Table','Table'[Dept]),
[YearWeek]=minweek
)
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please provide sample data in usable format and specify if you need this in Power Query or in DAX