Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
@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
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")))
User | Count |
---|---|
75 | |
74 | |
44 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |