Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Goodmorning Community,
i need your precious help.
I uploaded my dataset in xlsx.
Is not the complete dataset but is only the rows with FLG_KRI_08 = 1 e FLG_CONSOCIATA = 1 so we have to consider that the original dataset include also rows with these two flags with 0 values.
I need to calculate:
with a selected year NUM_ANNO in the slicer
the count of SKY_KRI_STORICO_VARIANTI for every group of SKY_KRI_CONTRATTO_PASSIVO only for the rows with FLG_KRI_08 = 1 e FLG_CONSOCIATA = 1.
We have to include in this count also the SKY_KRI_STORICO_VARIANTI of previous Years but only for the SKY_KRI_CONTRATTO_PASSIVO of the selected year.
For example:
2021
SKY_KRI_CONTRATTO_PASSIVO = 11287149 = 2
2020
SKY_KRI_CONTRATTO_PASSIVO = 11287149 = 1
I rememeber to pay attention that this dataset is not the complete dataset and it could be present in the original one other rows for every Years with the 2 flags with 0 values.
Thank you in advice for any help.
Solved! Go to Solution.
Thank you for your answer.
The logic it's clear but the formula was difficult to find.
With the help of artificial intelligence i was arrived to the solution with the
Hi @lucadelicio
You can create a measure
MEASURE =
CALCULATE (
DISTINCTCOUNT ( 'Table'[SKY_KRI_STORICO_VARIANTI] ),
ALL ( 'Table' ),
'Table'[SKY_KRI_CONTRATTO_PASSIVO]
IN VALUES ( 'Table'[SKY_KRI_CONTRATTO_PASSIVO] ),
'Table'[NUM_ANNO] <= MAX ( 'Table'[NUM_ANNO] ),
'Table'[FLG_KRI_08] = 1
&& 'Table'[FLG_CONSOCIATA] = 1
)
then create a table visual and put the measue to it.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you @Anonymous for your answer.
The formula is good and we are near to the solution. But the problem is that in the total of the rows we are considering also the [SKY_KRI_CONTRATTO_PASSIVO] that are not with the 2 flags = 1.
There is a way to modify the formula considering in the IN VALUES only the [SKY_KRI_CONTRATTO_PASSIVO] with FLG_KRI_08 = 1 and [FLG_CONSOCIATA] = 1?
The result that i need is a table with all the [SKY_KRI_CONTRATTO_PASSIVO] as rows and the total amount of the [SKY_KRI_STORICO_VARIANTI].
Thank you for your help
Hi @lucadelicio,
the issue is that the total row doesn't respect the filter on the two flags because Values( ) in the total context includes all contracts, even those not matching the flags.
To fix this
Isolate only the contracts from the selected year that also have both flags = 1.
Use that filtered list for both the individual rows and the total.
Regards,
Vinay
Thank you for your answer.
The logic it's clear but the formula was difficult to find.
With the help of artificial intelligence i was arrived to the solution with the
Someone can help me?
I can give you more information if you need.
Thank you
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!