Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello,
i have a problem with 2 same measures.
My casse is to count customers between 0-5% of % of grand total, and 5-10% of grand total
My code for 0-5% :
Broj kupaca 0-5 = 
VAR _tabela = ADDCOLUMNS(
    SUMMARIZE(
        OTP,
        OTP[Šifra kupca]
    ),
    "@Promet",[Promet],
    "@UkupanPromet",CALCULATE([Promet],REMOVEFILTERS(OTP[Šifra kupca]))
)
VAR _ucesce = ADDCOLUMNS(
    _tabela,
    "@Ucesce",DIVIDE([@Promet],[@UkupanPromet])
)
VAR _filtrirano = FILTER(
    _ucesce,
    [@Ucesce] >=0.00 && [@Ucesce]<=0.05
)
VAR _brojKupaca = COUNTROWS(_filtrirano)
RETURN _brojKupaca
and my code for 5-10% : 
Broj kupaca 5-10 = 
VAR _tabela = ADDCOLUMNS(
    SUMMARIZE(
        OTP,
        OTP[Šifra kupca]
    ),
    "@Promet",[Promet],
    "@UkupanPromet",CALCULATE([Promet],REMOVEFILTERS(OTP[Šifra kupca]))
)
VAR _ucesce = ADDCOLUMNS(
    _tabela,
    "@Ucesce",DIVIDE([@Promet],[@UkupanPromet])
)
VAR _filtrirano = FILTER(
    _ucesce,
    [@Ucesce] >=0.051 && [@Ucesce]<=0.10
)
VAR _brojKupaca = COUNTROWS(_filtrirano)
RETURN _brojKupaca
Now i will attach my photo :
in green are customers from 0-5%, and pink 5-10%
Values are correct, but for second formula i dont have a total. You can see at my image. 
Where is the problem?
@sima_ue031 To ensure that the total is calculated correctly, you can use the SUMX function to iterate over the table and sum the results. Here is how you can modify your measures:
Broj kupaca 0-5 = 
VAR _tabela = ADDCOLUMNS(
SUMMARIZE(
OTP,
OTP[Šifra kupca]
),
"@Promet",[Promet],
"@UkupanPromet",CALCULATE([Promet],REMOVEFILTERS(OTP[Šifra kupca]))
)
VAR _ucesce = ADDCOLUMNS(
_tabela,
"@Ucesce",DIVIDE([@Promet],[@UkupanPromet])
)
VAR _filtrirano = FILTER(
_ucesce,
[@Ucesce] >=0.00 && [@Ucesce]<=0.05
)
VAR _brojKupaca = COUNTROWS(_filtrirano)
RETURN 
IF(
HASONEVALUE(OTP[Šifra kupca]),
_brojKupaca,
SUMX(
VALUES(OTP[Šifra kupca]),
CALCULATE(_brojKupaca)
)
)
DAX
Broj kupaca 5-10 = 
VAR _tabela = ADDCOLUMNS(
SUMMARIZE(
OTP,
OTP[Šifra kupca]
),
"@Promet",[Promet],
"@UkupanPromet",CALCULATE([Promet],REMOVEFILTERS(OTP[Šifra kupca]))
)
VAR _ucesce = ADDCOLUMNS(
_tabela,
"@Ucesce",DIVIDE([@Promet],[@UkupanPromet])
)
VAR _filtrirano = FILTER(
_ucesce,
[@Ucesce] >=0.051 && [@Ucesce]<=0.10
)
VAR _brojKupaca = COUNTROWS(_filtrirano)
RETURN 
IF(
HASONEVALUE(OTP[Šifra kupca]),
_brojKupaca,
SUMX(
VALUES(OTP[Šifra kupca]),
CALCULATE(_brojKupaca)
)
)
| 
 Proud to be a Super User! | 
 | 
Look this. 
When I filter Naziv column, i got i totals : 
But when not filtering , i got blank : 
@bhanu_gautam My table filter i want to be a dinamicly. In this case filter is Naziv ( Category) but somethimes i want to put a ItemNo or something. And IF Hasonevalue not work propertly in other cases
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | 
| User | Count | 
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |