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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Analitika
Post Prodigy
Post Prodigy

How to count

I have i pbix file https://easyupload.io/9vy2gb

 

Analitika_0-1600420267480.png

 

How to make working Meausures with such logic

AfterDisc =
VAR App = sum(Table4[SUM_CRE])
VAR Percent0 = MAX(Table3[p0])
VAR Percent1 = MAX(Table3[p1])
VAR Percent2 = MAX(Table3[p2])
VAR Exc0 =
SWITCH(
TRUE(),
Max(Klients[klient]) = "JSC4" && MAx('Date'[sort_month]) >= "2019-11", 0,
DIVIDE(Percent0,100)
)
VAR Exc1 =
SWITCH(
TRUE(),
Max(Klients[klient]) = "JSC4" && MAx('Date'[sort_month]) >= "2019-11", 0,
DIVIDE(Percent1,100)
)
VAR Exc2 =
SWITCH(
TRUE(),
Max(Klients[klient]) = "JSC4" && MAx('Date'[sort_month]) >= "2019-11", 0,
DIVIDE(Percent2,100)
)
VAR PO = App - (APP*Exc0)- (APP*Exc1)- (APP*Exc2)

RETURN

SWITCH(
True(),
DATESBETWEEN('Date'[Date],"2017-01","2017-12"), App,
COUNT(Table4[SUM_CRE])<= 0, App,
Max(Klients[klient]) = "JSC2" , App,
Max(Klients[klient]) = "JSC3" , App,
PO
)
------------------------------------
Total_Discounts =
VAR App = [AfterDisc]
VAR Disc = SUM(Table2[Suma])
VAR AllDisc = Sum(Table1[suma])
VAR SUm_creByKlient = [SUm_creByKlient]
VAR P = SUm_creByKlient * AllDisc

RETURN

SWITCH(
TRUE(),
Max(Klients[klient]) = "JSC5" && Max(Goods[Code]) IN {"1","2","3"}, App,
App - DIVIDE(App,P) - Disc

)
 
Expected result for code 47746010

AfterDisc = 643.20
Total_Discounts = 433.09
2 REPLIES 2
v-diye-msft
Community Support
Community Support

Hi @Analitika 

 

I've worked out the problem in your capture, I attached the pbix here

7.PNG

but for the measure, plz elaborate more

Max(Klients[klient]) = "JSC4" && MAx('Date'[sort_month]) >= "2019-11"

would you like to set the Klients as slicer? so the logic should be when slicer is "JSC4",and date slicer >= 2019-11, then exc0 = 0?

also for this part:

SWITCH(
True(),
DATESBETWEEN('Date'[Date],"2017-01","2017-12"), App,
COUNT(Table4[SUM_CRE])<= 0, App,
Max(Klients[klient]) = "JSC2" , App,
Max(Klients[klient]) = "JSC3" , App,
PO
)
Plz confirm the how's work for Klient column.
 
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Ty, but file is wrong

 

I need make work thoose parts, klients cant be in slicer, only in measures!!!

 

Max(Klients[klient]) = "JSC4" && MAx('Date'[sort_month]) >= "2019-11"

DATESBETWEEN('Date'[Date],"2017-01","2017-12"), App,

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors