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! Request now

Reply
Anonymous
Not applicable

Calculated Column

Hi,

 

I want to check how do I calculate column based on different categories in a row

For eg.

 

Groups           Flow

sb003            159000                                                   GH003      77000

d2004            139000

ch001            156000                                                  No. of days = 10

f4500             200000

 

I have to write a formula like SB003 + D2004-CH001-F4500-GH003*(NO. OF DAYSINMONTH)

1 ACCEPTED SOLUTION

@Anonymous , check the first line

Var _max = maxx(allselected(Dates),Dates[date])

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

View solution in original post

9 REPLIES 9
Pragati11
Super User
Super User

Hi @Anonymous ,

 

In Edit Query, select your GROUPS column, Pivot it.

 

Then normally create a DAX:

SB003 + D2004-CH001-F4500-GH003*(NO. OF DAYSINMONTH)

The values above will become your columns and directly use them to add.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

amitchandak
Super User
Super User

@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

This does not seem like the format data is there in power BI

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
Anonymous
Not applicable

@amitchandak  Here's the sample data

 

Sample2.PNG

@Anonymous , Try like

measure =
Var _max = maxx(allselected(Date),Date[date])
var _Min= eodate(_max,-1)+1
Var _noDay = datediff(_Min,_max,Day)
return
(calculate(sum(Table[total Value]), Table[group] in {"SB003","D2004"}) - calculate(sum(Table[total Value]), Table[group] in {"CH001","F4500","GH003"}))* _noDay

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
Anonymous
Not applicable

@Anonymous , my Mistake

it should be eomonth

var _Min= eomonth(_max,-1)+1

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
Anonymous
Not applicable

@amitchandak  I think it's still not picking up the variables. it has to do something with Var syntaxError.PNG

@Anonymous , check the first line

Var _max = maxx(allselected(Dates),Dates[date])

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
Anonymous
Not applicable

@amitchandak  This works! Thank you so much

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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