Forum Discussion
count data report visuals
- 1 year ago
Hi bzeeblitz ,
Thank you for reaching out to the Microsoft Fabric Forum Community.I've carefully reviewed your requirements and have reproduced your scenario using sample data. I'm happy to report that I've found a solution that provides the output you're looking for.
To achieve this, I used a combination of two measures within Power BI. Here's a breakdown:
- This measure handles the count for each individual row in your visual, displaying '0' when POCreatedWhen is "PO Not Created Yesterday" and counting the Purchase Orders when POCreatedWhen is "PO Created Yesterday".
TotalPO = VAR CurrentDate = SELECTEDVALUE(HistoricalPOdata[Date]) RETURN IF( MAX(HistoricalPOdata[POCreatedWhen]) = "PO Not Created Yesterday", 0, CALCULATE( COUNT(HistoricalPOdata[Title]), FILTER( ALL(HistoricalPOdata), HistoricalPOdata[POCreatedWhen] = "PO Created Yesterday" && HistoricalPOdata[Date] = CurrentDate ) ) )- This measure is specifically designed to calculate the total, ensuring it sums only the TotalPO values where POCreatedWhen is "PO Created Yesterday". This overrides the default total calculation.
TotalPOCreatedYesterday = CALCULATE ( SUMX(VALUES(HistoricalPOdata[Date]), [TotalPO]), FILTER ( ALL ( HistoricalPOdata ), HistoricalPOdata[POCreatedWhen] = "PO Created Yesterday" ) )To help you get started, I've attached a sample .pbix file that demonstrates this solution. You can download it and explore the measures and visual setup directly.
If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.
Hi bzeeblitz
Try this:
VAR _count =
CALCULATE (
[count of po],
KEEPFILTERS ( 'table'[POCreatedWhen] <> "PO Not Created Yesterday" )
)
RETURN
IF (
SELECTEDVALUE ( 'table'[POCreatedWhen] ) = "PO Not Created Yesterday",
0,
_count
)
This will exclude PO Not Created Yesterday from the total as well.
- bzeeblitz1 year agoHelper IV
- Please clarify wats this CALCULATE (
[count of po] in your above formula as I don't use anything as count of po and pls clarify
- bzeeblitz1 year agoHelper IV
Above formula contains error Return If is not recognized i altered to Return In but I'm facing errors multiple columns cannot be converted to a scalar value