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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
)

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
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.