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.
Hello,
I am trying to get sum of broken items per month for each ID within status for the earliest date available in the dataset (as they continously are in dataset for next months with the same status, but I want to count it only once in the month it has broke)
Status has to be = "B". I also need to use relationship because I have already established active relation between Active items and calendar
So I was thinking of
Calculate ( SUM ( ItemID ),
Table[ItemStatus] = "B",
MIN( Table[InActiveItemsDat] ),
USERELATIONSHIP ( Table[InActiveItemsDat], Calendar[Date] )
)
however it doesnt work
Solved! Go to Solution.
Hi @Pbiuserr ,
Please try these measures to see if they return correct result.
FirstDate =
CALCULATE (
MIN ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[ItemStatus] = "B"
&& 'Table'[ItemID] = MAX ( 'Table'[ItemID] )
),
ALL (),
USERELATIONSHIP ( 'Calendar'[Date], 'Table'[InActiveItemsDat] )
)
IDCount =
SUMX (
'Table',
CALCULATE (
COUNTROWS ( 'Calendar' ),
FILTER ( 'Calendar', 'Calendar'[Date] = [FirstDate] ),
USERELATIONSHIP ( 'Calendar'[Date], 'Table'[InActiveItemsDat] )
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Pbiuserr , You need to try a measure like
Calculate ( SUM ( ItemID ),
Filter( Table, Table[ItemStatus] = "B" && Table[InActiveItemsDat] = minx(filter(allselected(Table), Table[ID] = Max(Table[ID])), Table[InActiveItemsDat]))
USERELATIONSHIP ( Table[InActiveItemsDat], Calendar[Date] )
)
refer
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
Hi,
unfortunately it gives me blank value, so it doesnt count
Hi @Pbiuserr ,
Please try these measures to see if they return correct result.
FirstDate =
CALCULATE (
MIN ( 'Calendar'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[ItemStatus] = "B"
&& 'Table'[ItemID] = MAX ( 'Table'[ItemID] )
),
ALL (),
USERELATIONSHIP ( 'Calendar'[Date], 'Table'[InActiveItemsDat] )
)
IDCount =
SUMX (
'Table',
CALCULATE (
COUNTROWS ( 'Calendar' ),
FILTER ( 'Calendar', 'Calendar'[Date] = [FirstDate] ),
USERELATIONSHIP ( 'Calendar'[Date], 'Table'[InActiveItemsDat] )
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
98 | |
75 | |
63 | |
62 |
User | Count |
---|---|
135 | |
105 | |
104 | |
80 | |
65 |