Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi everyone,
I am trying to have my data at 1130 pm to minus data at 12 am on the same day. I dont know how to code that, sorry as i am new to microsoft power bi.
In a separate column, i had these data extracted:
However, this is what i get if i directly minus both parameters:
Solved! Go to Solution.
Hi @Anonymous ,
Sample data
Here's my solution.
Create the following measures.
At 1130 PM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', FORMAT ( [Date/Time], "HH:MM:SS" ) = "23:30:00" )
)
At 12AM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', FORMAT ( [Date/Time], "HH:MM:SS" ) = "00:00:00" )
)
Subtraction =
VAR _1130PM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
FORMAT ( [Date/Time], "HH:MM:SS" ) = "23:30:00"
)
)
VAR _12AM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
FORMAT ( [Date/Time], "HH:MM:SS" ) = "00:00:00"
)
)
RETURN
_1130PM - _12AM
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous can you paste data in the table format (instead of image) and the expected output. Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Oh i am sorry, i am rather new here so i am not sure how to copy the table.
Expected output
Date/Time | At 1130 PM | At 12AM | Subtraction |
22/1/22 11:30:00PM | 150 | 105 | |
22/1/22 12:00:00AM | 45 |
Hi @Anonymous ,
Sample data
Here's my solution.
Create the following measures.
At 1130 PM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', FORMAT ( [Date/Time], "HH:MM:SS" ) = "23:30:00" )
)
At 12AM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', FORMAT ( [Date/Time], "HH:MM:SS" ) = "00:00:00" )
)
Subtraction =
VAR _1130PM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
FORMAT ( [Date/Time], "HH:MM:SS" ) = "23:30:00"
)
)
VAR _12AM =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
FORMAT ( [Date/Time], "HH:MM:SS" ) = "00:00:00"
)
)
RETURN
_1130PM - _12AM
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
88 | |
82 | |
65 | |
64 | |
58 |
User | Count |
---|---|
171 | |
112 | |
110 | |
72 | |
72 |