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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

need help

Hello all,

I have a data set where I have field as Query1[BILLYEARMONTH], Query1[LT_HT] and Query1[NET BILLING AMOUNT]. Now in my field

Query1[LT_HT] values are as follow: 1). HT 2). EHT 3). Three Phase 4). Single Phase. In the field Query1[BILLYEARMONTH], i have values of year/month as 202202, 202203, 202204 and so on. Field Query1[NET BILLING AMOUNT] is my amount to be calculated. 

 

Now i want condition in DAX as:

When Query1[BILLYEARMONTH] = 202203, the Query1[NET BILLING AMOUNT] will be picked based on Query1[LT_HT] =  "HT"  & "EHT" and   Query1[NET BILLING AMOUNT] for Query1[LT_HT] ="Single Phase" & "Three Phase" should be from the next month which is for example "202204".

 

That means, Current month should consider Amount with filters as "HT" and "EHT" + Amount with filter as "Single Phase" and "Three Phase" from the next month. 

 

How to achieve the same, i tried a lot but not getting the desired result. Plase help.

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You can try like

CALCULATE(SUM(Query1[NET_BILLING_AMOUNT]), filter(Query1, (Query1[BILLYEARMONTH] = 202203 && (Query1[LT_HT] in{ "Single Phase" , "Three Phase")) || (Query1[BILLYEARMONTH] = 202202 && (Query1[LT_HT] in { "HT" ,"EHT" })) ))

 

To make month dynamic you can use time intelligence

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

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

I tried something like this:

 

Amount for Feb_22 = CALCULATE(SUM(Query1[NET_BILLING_AMOUNT]), (Query1[BILLYEARMONTH] = 202203 && (Query1[LT_HT] = "Single Phase" || Query1[LT_HT] = "Three Phase")) || (Query1[BILLYEARMONTH] = 202202 && (Query1[LT_HT] = "HT" || Query1[LT_HT] = "EHT")))

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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