Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Digger
Post Patron
Post Patron

Divide does not show result

I have measures

_Test1 =

VAR NETO_SALES = CALCULATE([Sales])
VAR COGS = CALCULATE([COGS],FILTER(Table,[Group]="COGS"))

RETURN

SWITCH (
SELECTEDVALUE ( Lists[Budzet] ),
"NETO SALES", NETO_SALES,
"COGS", COGS
)

_Test2 =

VAR NETO_SALES = CALCULATE([Sales])
VAR COGS_1 = CALCULATE([COGS],FILTER(Table,[Group]="COGS"))
VAR COGS = DIVIDE(COGS_1,NETO_SALES)

RETURN

SWITCH (
SELECTEDVALUE ( Lists[Budzet] ),
"NETO SALES", DIVIDE(NETO_SALES,NETO_SALES),
"COGS", COGS
)

But _Test2 measure does not retur percent on each code, only total
Digger_0-1637848683599.png

How return values for each code?

1 ACCEPTED SOLUTION
Digger
Post Patron
Post Patron

SOLVED
VAR NETO_SALES = CALCULATE([Sales],ALL())

View solution in original post

3 REPLIES 3
Digger
Post Patron
Post Patron

SOLVED
VAR NETO_SALES = CALCULATE([Sales],ALL())

amitchandak
Super User
Super User

@Digger , seem like there some white space or special character in COGS, try like

 

_Test2 =

VAR NETO_SALES = CALCULATE([Sales])
VAR COGS_1 = CALCULATE([COGS],FILTER(Table,[Group]="COGS"))
VAR COGS = DIVIDE(COGS_1,NETO_SALES)

RETURN

SWITCH (
SELECTEDVALUE ( Lists[Budzet] ),
"NETO SALES", DIVIDE(NETO_SALES,NETO_SALES),
 COGS
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak No you wrong, as you can see _Test1 measure working very well as does not have divide function, but if divide funcion exists in measure it will not work

 

ithink there problem with VAR NETO_SALES = CALCULATE([Sales])  as there not exist codes starting from 6, and PBI just divide from 0, NETO_SALES should be fixed value in all cases, as i need each code starting from 6 divide from 62124.09 (total neto_sales)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.